You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Svelte ships with type definitions (types/compiler/index.d.ts and types/compiler/interfaces.d.ts) that reference type definitions from estree and estree-walker. However, Svelte does not ship with these estree type definitions and does not reference them as dependencies, so they don't exist at install time, therefore Svelte's type definitions are broken. This hinders me in running the TypeScript compiler on my own code, even though this issue has nothing to do with me.
node_modules/.pnpm/[email protected]/node_modules/svelte/types/compiler/index.d.ts:4:22 - error TS2307: Cannot find module 'estree-walker' or its corresponding type declarations.
4 export { walk } from 'estree-walker';
~~~~~~~~~~~~~~~
node_modules/.pnpm/[email protected]/node_modules/svelte/types/compiler/interfaces.d.ts:1:53 - error TS2307: Cannot find module 'estree' or its corresponding type declarations.
1 import { AssignmentExpression, Node, Program } from 'estree';
I thought to install @types/estree and estree-walker as a temporary workaround, but even this does not work, because there exists an ESM/CJS incompatibility in the reference to the estree-walker types.
node_modules/.pnpm/[email protected]/node_modules/svelte/types/compiler/index.d.ts:4:22 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("estree-walker")' call instead.
4 export { walk } from 'estree-walker';
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
Svelte ships with type definitions (
types/compiler/index.d.ts
andtypes/compiler/interfaces.d.ts
) that reference type definitions fromestree
andestree-walker
. However, Svelte does not ship with theseestree
type definitions and does not reference them as dependencies, so they don't exist at install time, therefore Svelte's type definitions are broken. This hinders me in running the TypeScript compiler on my own code, even though this issue has nothing to do with me.I thought to install
@types/estree
andestree-walker
as a temporary workaround, but even this does not work, because there exists an ESM/CJS incompatibility in the reference to theestree-walker
types.This issue was first reported in #3397 in 2019, and was apparently fixed, and then was apparently regressed not too long after, and then was never fixed again. This issue is very much still present.
Reproduction
Any trivial TypeScript setup importing
svelte/compiler
should reproduce this issue.Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: