Skip to content

Commit

Permalink
build(types): disable preserveSymlinks in tsconfig
Browse files Browse the repository at this point in the history
PNPM uses symlinks by default for `node_modules`
(see the [`node-linker`][1] options), which doesn't work with
[TypeScript's `preserveSymlinks: true`][2] setting.

This meant that the `d3-transition` types were not applying properly in
our code.

[1]: https://pnpm.io/npmrc#node-linker
[2]: https://www.typescriptlang.org/tsconfig/#preserveSymlinks
  • Loading branch information
aloisklink committed Sep 17, 2024
1 parent 7a86fd7 commit f12df39
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 6 deletions.
2 changes: 0 additions & 2 deletions packages/mermaid/src/diagrams/class/classDb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@ const setupToolTips = function (element: Element) {
// @ts-ignore - getBoundingClientRect is not part of the d3 type definition
const rect = this.getBoundingClientRect();

// @ts-expect-error - Incorrect types
tooltipElem.transition().duration(200).style('opacity', '.9');
tooltipElem
.text(el.attr('title'))
Expand All @@ -399,7 +398,6 @@ const setupToolTips = function (element: Element) {
el.classed('hover', true);
})
.on('mouseout', function () {
// @ts-expect-error - Incorrect types
tooltipElem.transition().duration(500).style('opacity', 0);
const el = select(this);
el.classed('hover', false);
Expand Down
2 changes: 0 additions & 2 deletions packages/mermaid/src/diagrams/flowchart/flowDb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,6 @@ const setupToolTips = function (element: Element) {
}
const rect = (this as Element)?.getBoundingClientRect();

// @ts-ignore TODO: fix this
tooltipElem.transition().duration(200).style('opacity', '.9');
tooltipElem
.text(el.attr('title'))
Expand All @@ -435,7 +434,6 @@ const setupToolTips = function (element: Element) {
el.classed('hover', true);
})
.on('mouseout', function () {
// @ts-ignore TODO: fix this
tooltipElem.transition().duration(500).style('opacity', 0);
const el = select(this);
el.classed('hover', false);
Expand Down
1 change: 0 additions & 1 deletion packages/parser/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"rootDir": ".",
"outDir": "./dist",
"allowJs": false,
"preserveSymlinks": false,
"strictPropertyInitialization": false
},
"include": ["./src/**/*.ts", "./tests/**/*.ts"],
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */,
"preserveSymlinks": true /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */,
// "preserveSymlinks": true /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */,
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,

/* Type Checking */
Expand Down

0 comments on commit f12df39

Please sign in to comment.