-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Closed
Copy link
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
π Search Terms
Error: Debug Failure. False expression. at getOptionalType
π Version & Regression Information
Crashes with 5.6.3
and next
, but works fine with previous release 5.5.4
.
β― Playground Link
Couldn't get it to work in the playground. Instead, see below for a repro.
π» Code
import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react";
const slice = createApi({
reducerPath: "userApi",
baseQuery: fetchBaseQuery({}),
endpoints: (builder) => ({
test: builder.query<any, void>({
query: () => ({
url: `/user`,
}),
}),
}),
});
export const { useTestQuery } = slice;
π Actual behavior
Crash
Error: Debug Failure. False expression.
at getOptionalType (/home/seb/tmp/1/node_modules/typescript/lib/_tsc.js:66507:11)
at Object.canReuseTypeNodeAnnotation (/home/seb/tmp/1/node_modules/typescript/lib/_tsc.js:50282:28)
at serializeTypeAnnotationOfDeclaration (/home/seb/tmp/1/node_modules/typescript/lib/_tsc.js:131464:19)
at typeFromProperty (/home/seb/tmp/1/node_modules/typescript/lib/_tsc.js:131687:36)
at Object.serializeTypeOfDeclaration (/home/seb/tmp/1/node_modules/typescript/lib/_tsc.js:131519:16)
at serializeTypeForDeclaration (/home/seb/tmp/1/node_modules/typescript/lib/_tsc.js:52429:41)
at addPropertyToElementList (/home/seb/tmp/1/node_modules/typescript/lib/_tsc.js:51321:43)
at createTypeNodesFromResolvedType (/home/seb/tmp/1/node_modules/typescript/lib/_tsc.js:51217:11)
at createTypeNodeFromObjectType (/home/seb/tmp/1/node_modules/typescript/lib/_tsc.js:50984:25)
at visitAndTransformType (/home/seb/tmp/1/node_modules/typescript/lib/_tsc.js:50907:24)
π Expected behavior
No crash.
Additional information about the issue
Repro:
$ git clone https://github.com/sebcode/tsccrashbugrepro.git
$ cd tsccrashbugrepro/
$ yarn
$ yarn tsc
yarn run v1.22.21
warning package.json: No license field
$ /home/seb/tmp/1/node_modules/.bin/tsc
/home/seb/tmp/1/node_modules/typescript/lib/_tsc.js:121666
throw e;
^
Error: Debug Failure. False expression.
at getOptionalType (/home/seb/tmp/1/node_modules/typescript/lib/_tsc.js:66507:11)
at Object.canReuseTypeNodeAnnotation (/home/seb/tmp/1/node_modules/typescript/lib/_tsc.js:50282:28)
at serializeTypeAnnotationOfDeclaration (/home/seb/tmp/1/node_modules/typescript/lib/_tsc.js:131464:19)
at typeFromProperty (/home/seb/tmp/1/node_modules/typescript/lib/_tsc.js:131687:36)
at Object.serializeTypeOfDeclaration (/home/seb/tmp/1/node_modules/typescript/lib/_tsc.js:131519:16)
at serializeTypeForDeclaration (/home/seb/tmp/1/node_modules/typescript/lib/_tsc.js:52429:41)
at addPropertyToElementList (/home/seb/tmp/1/node_modules/typescript/lib/_tsc.js:51321:43)
at createTypeNodesFromResolvedType (/home/seb/tmp/1/node_modules/typescript/lib/_tsc.js:51217:11)
at createTypeNodeFromObjectType (/home/seb/tmp/1/node_modules/typescript/lib/_tsc.js:50984:25)
at visitAndTransformType (/home/seb/tmp/1/node_modules/typescript/lib/_tsc.js:50907:24)
Node.js v20.8.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue