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

Typescript check crashing vite serve #401

Open
2 tasks done
cwagner22 opened this issue Sep 12, 2024 · 2 comments
Open
2 tasks done

Typescript check crashing vite serve #401

cwagner22 opened this issue Sep 12, 2024 · 2 comments

Comments

@cwagner22
Copy link

cwagner22 commented Sep 12, 2024

Describe the bug

There are no typescript errors but every time I start my vite server, it crashes after a few hmr updates. All I see is this:

node:internal/event_target:1090
  process.nextTick(() => { throw err; });
                           ^
Error: Debug Failure. False expression.
    at getOptionalType (/Users/c/project/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:70825:11)
    at tryReuseExistingTypeNode (/Users/c/project/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:54296:16)
    at serializeTypeForDeclaration (/Users/c/project/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:56314:61)
    at addPropertyToElementList (/Users/c/project/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:55284:43)
    at createTypeNodesFromResolvedType (/Users/c/project/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:55180:11)
    at createTypeNodeFromObjectType (/Users/c/project/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:54955:25)
    at visitAndTransformType (/Users/c/project/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:54878:24)
    at createAnonymousTypeNode (/Users/c/project/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:54818:20)
    at typeToTypeNodeWorker (/Users/c/project/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:54611:16)
    at typeToTypeNodeHelper (/Users/c/project/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:54392:24)

Node.js v22.7.0
Warning: command "vite serve" exited with non-zero status code

The getOptionalType function crashes on line Debug.assert(strictNullChecks) because I have strict: false in my tsconfig.

Reproduction

I haven't yet narrowed down a way to reproduce the issue because this is a nx monorepo. I will add it if I find a way. Here is the --showConfig output.

{
    "compilerOptions": {
        "rootDir": "../..",
        "sourceMap": true,
        "declaration": false,
        "moduleResolution": "node10",
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "importHelpers": true,
        "target": "es2021",
        "module": "esnext",
        "lib": [
            "es2021",
            "dom"
        ],
        "skipLibCheck": true,
        "skipDefaultLibCheck": true,
        "resolveJsonModule": true,
        "baseUrl": "./src",
        "paths": {
            "@ui/*": [
                "../../ui/src/*"
            ],
        },
        "strict": false,
        "jsx": "react-jsx",
        "allowJs": false,
        "esModuleInterop": false,
        "allowSyntheticDefaultImports": true,
        "jsxImportSource": "@emotion/react",
        "types": [
            "node",
            "@nx/react",
            "vite/client"
        ],
        "outDir": "../../dist/out-tsc",
        "noEmit": true
    },
    "files": [...],
    "include": [
        "src/**/*.js",
        "src/**/*.jsx",
        "src/**/*.ts",
        "src/**/*.tsx"
    ],
    "exclude": [
        "src/**/*.spec.ts"
    ]
}

Expected behavior

No crash

System Info

Node: 22.7.0
vite-plugin-checker: 0.8.0
typescript: 5.6.2

Additional context

checker({
  typescript: {
    tsconfigPath: 'tsconfig.app.json',
  },
})

No response

Validations

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
@Amnesthesia
Copy link

We're also getting this, but with webpack

Seems to be unrelated to vite and probably related to something in typescript 5.3+

@spradlin-dev
Copy link

I'm seeing the same issue with vite in both typescript 5.6.2 and 5.2.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants