TypeScript examples don't compile with `tsc`
See original GitHub issueCurrently, the typescript/graphql-auth
example works when following the instructions from the README:
npm install
npm run dev
This starts the server as expected and you can send queries to it.
However, when compiling with tsc
, it fails:
$ npx tsc
src/types/Mutation.ts:70:13 - error TS2322: Type '{ connect: { id: string | undefined; }; }' is not assignable to type 'UserCreateOneWithoutPostsInput'.
The types of 'connect.id' are incompatible between these types.
Type 'string | undefined' is not assignable to type 'number | null | undefined'.
Type 'string' is not assignable to type 'number | null | undefined'.
70 author: { connect: { id: userId } },
~~~~~~
node_modules/@prisma/client/index.d.ts:2558:3
2558 author?: UserCreateOneWithoutPostsInput | null
~~~~~~
The expected type comes from property 'author' which is declared here on type 'PostCreateInput'
src/types/Mutation.ts:83:13 - error TS2322: Type 'string | null | undefined' is not assignable to type 'number | null | undefined'.
Type 'string' is not assignable to type 'number | null | undefined'.
83 id,
~~
node_modules/@prisma/client/index.d.ts:2535:3
2535 id?: number | null
~~
The expected type comes from property 'id' which is declared here on type 'PostWhereUniqueInput'
src/types/Mutation.ts:95:20 - error TS2322: Type 'string | null | undefined' is not assignable to type 'number | null | undefined'.
Type 'string' is not assignable to type 'number | null | undefined'.
95 where: { id },
~~
node_modules/@prisma/client/index.d.ts:2535:3
2535 id?: number | null
~~
The expected type comes from property 'id' which is declared here on type 'PostWhereUniqueInput'
Found 3 errors.
We should:
- check whether this happens also for other TS examples
- fix the errors in
typescript/graphql-auth
and any others we find
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Documentation - tsc CLI Options - TypeScript
Flag Type Default
‑‑allowJs boolean false
‑‑allowUmdGlobalAccess boolean false
‑‑allowUnreachableCode boolean
Read more >typescript compiler (tsc) command not working with tsconfig
and I run tsc on command prompt, but it won't work and outputs me the syntax, example and options of how to use...
Read more >TypeScript Compiling with Visual Studio Code
Under the covers, we run the TypeScript compiler as a task. The command we use is: tsc -p . Step 3: Make the...
Read more >Getting Started With TypeScript Compiler (tsc) - maxoid.io
Don't focus on the code too much. It's just an example of TypeScript code but first of all, we need to focus on...
Read more >Do not perform typechecking if files are unchanged ... - GitHub
We call tsc with pinned versions of both Node and TypeScript and point it to the tsconfig.json file with the -p compiler flag....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yeah, it probably happens in most TS examples I could imagine since we never tested for that…
@ngduc Please open a new issue and describe in which repository this happens exactly. Thanks!