Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Estree types missing #10010

Closed
keliss opened this issue Dec 27, 2023 · 1 comment · Fixed by #10150
Closed

Estree types missing #10010

keliss opened this issue Dec 27, 2023 · 1 comment · Fixed by #10150
Assignees

Comments

@keliss
Copy link

keliss commented Dec 27, 2023

Describe the bug

Hello. After setting up a Svelte project with Typescript, I bumped into an error with missing type definitions for estree. I think they should ship with Svelte by default.

Reproduction

  1. Run yarn create vite my-app --template svelte-ts
  2. In package.json, change the build script to tsc --noEmit && vite build
  3. Run yarn build

Running yarn add -D @types/estree solves the issue.

Logs

../../.yarn/berry/cache/svelte-npm-4.2.8-42f12ed9c1-10c0.zip/node_modules/svelte/types/index.d.ts:276:59 - error TS2307: Cannot find module 'estree' or its corresponding type declarations.

276  import type { AssignmentExpression, Node, Program } from 'estree';
                                                              ~~~~~~~~

../../.yarn/berry/cache/svelte-npm-4.2.8-42f12ed9c1-10c0.zip/node_modules/svelte/types/index.d.ts:868:59 - error TS2307: Cannot find module 'estree' or its corresponding type declarations.

868  import type { AssignmentExpression, Node, Program } from 'estree';
                                                              ~~~~~~~~


Found 2 errors in the same file, starting at: ../../.yarn/berry/cache/svelte-npm-4.2.8-42f12ed9c1-10c0.zip/node_modules/svelte/types/index.d.ts:276

System Info

System:
    OS: macOS 12.5
    CPU: (10) arm64 Apple M1 Max
    Memory: 253.09 MB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
    Yarn: 4.0.2 - ~/.nvm/versions/node/v20.10.0/bin/yarn
    npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm
  Browsers:
    Chrome: 120.0.6099.129
    Safari: 15.6

Severity

annoyance

@keliss
Copy link
Author

keliss commented Dec 27, 2023

Here's the tsconfig.json in case you need it.

{
  "extends": "@tsconfig/svelte/tsconfig.json",
  "include": ["src/**/*.ts", "src/**/*.js", "src/**/*.svelte"],
  "references": [{ "path": "./tsconfig.node.json" }],
  "compilerOptions": {
    "target": "ESNext",                                  /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
    "useDefineForClassFields": true,                     /* Emit ECMAScript-standard-compliant class fields. */
    "module": "ESNext",                                  /* Specify what module code is generated. */
    "rootDir": "src",                                    /* Specify the root folder within your source files. */
    "baseUrl": "./src",                                  /* Specify the base directory to resolve non-relative module names. */
    "resolveJsonModule": true,                           /* Enable importing .json files. */
    "allowJs": true,                                     /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
    "checkJs": true,                                     /* Enable error reporting in type-checked JavaScript files. */
    "sourceMap": true,                                   /* Create source map files for emitted JavaScript files. */
    "outDir": "dist",                                    /* Specify an output folder for all emitted files. */
    "isolatedModules": true,                             /* Ensure that each file can be safely transpiled without relying on other imports. */
    "esModuleInterop": true,                             /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
    "forceConsistentCasingInFileNames": true,            /* Ensure that casing is correct in imports. */
    "strict": true,                                      /* Enable all strict type-checking options. */
    "skipLibCheck": false                                 /* Skip type checking all .d.ts files. */
  }
}

@dummdidumm dummdidumm self-assigned this Jan 9, 2024
dummdidumm added a commit that referenced this issue Jan 10, 2024
types are exposed through our types, so we need to add it as a dependency
fixes #10010
dummdidumm added a commit that referenced this issue Jan 10, 2024
types are exposed through our types, so we need to add it as a dependency
fixes #10010
dummdidumm added a commit that referenced this issue Jan 11, 2024
types are exposed through our types, so we need to add it as a dependency
fixes #10010
dummdidumm added a commit that referenced this issue Jan 11, 2024
types are exposed through our types, so we need to add it as a dependency
fixes #10010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants