Closed tobiasdcl closed 1 month ago
Upgraded to typescript 5.5.3
from 5.4.5
today, and found similar issue.
I'm not able to repro with 5.5.3. I see:
$ npx tsc --version
Version 5.5.3
$ npx tsc --noEmit
test.ts:12:9 - error TS2322: Type 'boolean' is not assignable to type 'number'.
12 id: true,
I just tested again with the latest version of openapi-typescript
(7.1.0
) and openapi-fetch
(0.10.2
) - still not getting any error (except when using ts version 5.4.5
).
I also added the tsconfig.json
that I used - hope this helps to reproduce it
Even with your tsconfig.json, I still can't repro... I'm using same versions of everything. Can you make a docker image that repros issue, or perhaps a github repo that repros issue in github actions?
Note my dev environment is Linux. Are you on Windows or Linux?
I was struggling with this in a test node 20 project using @tsconfig/node20 tsconfig.json
I found if I deleted the entire "lib": [ "es2023" ],
property, the type enforcement worked again.
I am on Windows 11 Pro 22H2 using Node v20.10.0. Attached is my repo - repo.zip Hopefully this helps
I am running into the same issue. Multipackage repo. Upgraded to typescript 5.5.4 and some valid type errors on arguments to calls of the openapi-fetch
client methods disappeared.
FYI: openapi-fetch v0.10.4 includes the fix
Description
types are not enforced with typescript
5.5.3
Reproduction
src/repro.ts
tsconfig
### `tsconfig.json` ```json { "compilerOptions": { "lib": ["ES2023"], "module": "commonjs", "target": "ES2022", "strict": true, "declaration": true, "removeComments": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "allowSyntheticDefaultImports": true, "esModuleInterop": true, "sourceMap": true, "outDir": "./dist", "baseUrl": ".", "incremental": true, "skipLibCheck": true, "strictNullChecks": true, "noImplicitAny": true, "noUncheckedIndexedAccess": true, "strictBindCallApply": true, "forceConsistentCasingInFileNames": true, "noFallthroughCasesInSwitch": false, "resolveJsonModule": true }, "include": [ "src/**/*", ], "exclude": ["node_modules", "dist"] } ```Expected result
npx tsc --noEmit
should result in something along the lines of:This does work as expected with typescript
5.4.5
. If you runnpx tsc --noEmit
with typescript5.5.3
no error is reported (which should not be the case). I saw that the project dependency on typescript is still on the5.4
release. I am assuming there is some incompatibility with typescript 5.5 and this is one of the symptoms.I took a quick look at the changed in TS 5.5 and found
Control Flow Narrowing for Constant Indexed Accesses
. I thought this might be related but it is just a gut feeling.Checklist
Thanks for the great work ❤️