Comments (6)
I just verified - the error does not appear in TS 4.8.4, and it is still there in 4.9.5.
from pothos.
If I change the nullable to nullable: { items: true, list: false }
, the error becomes (the possibly more clarifying)
error TS2322: Type '{ items: true; list: false; }' is not assignable to type '({ items: true; list: false; } & true) | ({ items: true; list: false; } & { items: boolean; list: boolean; } & true) | undefined'.
Type '{ items: true; list: false; }' is not assignable to type '{ items: true; list: false; } & { items: boolean; list: boolean; } & true'.
Type '{ items: true; list: false; }' is not assignable to type 'true'
from pothos.
I tried to reproduce this issue, but have not been able to:
https://stackblitz.com/edit/typescript-rmf22w?file=index.ts,tsconfig.json
This sees specific to types not included in the example above
from pothos.
Thanks for looking into it! After trying for quite a while to extend the stackblitz enough without succeeding, I finally realized that explicitly typing the return value of Group.children
to string[]
resolves the issue.
I'm a bit curious why the stackblitz differs from my code though. I tried
export class Group {
get children(): ("a" | "b")[] {
return ["a"]; //GROUP_DEFINITIONS[<GroupName>this.name];
}
}
type Foo = ExposeNullableOption<
PothosSchemaTypes.ExtendDefaultTypes<{}>,
["String"],
Group,
"children"
>;
In the "real" code (using VS code tooltips), Foo resolves to
type Foo = FieldNullability<["String"]> & (true | {
items: boolean;
list: true;
} | {
items: boolean;
list: true;
})
But in stackblitz it's
type Foo = FieldNullability<["String"]> & (boolean | {
items: boolean;
list: boolean;
} | {
items: boolean;
list: boolean;
})
I'm no typescript expert, but It seems like this could be a typescript bug.
type Bar = Group["children"] extends NonNullable<Group["children"]>
? true
: false;
resolves to true
in both my local editor and in stackblitz, which I think means that nullable should be allowed to be false.
from pothos.
Thanks for the detailed reply! Figured out the issue, and fixed it here: 3021b43
from pothos.
Works like a charm! Thanks for persisting!
from pothos.
Related Issues (20)
- Prisma `t.relatedConnection` Failing to Throw Typing Errors HOT 2
- Authz Plugin overwrites the directives plugin HOT 4
- Question: How to use t.connection to behave like t.relatedConnection HOT 3
- Indirect prisma relations has type errors. HOT 3
- Can prismaConnectionHelpers provide totalCount field? HOT 2
- Sentry tracing not showing the field name in description HOT 1
- Setting auth scope based on a returned type HOT 2
- Prisma plugin failing on call to builder.prismaObject() HOT 7
- `withAuth` and `authScopes` don't combine HOT 2
- Argument of type 'string' is not assignable to parameter of type 'never' HOT 2
- Pothos subscriptionField + withFilter are breaking the type inference of subscription arguments HOT 5
- How to support HMR with Pothos HOT 2
- loadableGroup load/group seems to infer the wrong type HOT 2
- Please review this pr adding progressive override to your federation plugin
- Prisma generator generate wrong imports when using ESM HOT 2
- Pitfall when calling a schema locally from another schema using auth scopes
- [Suggestion] SubGraph-specific context type with subgraph plugin HOT 1
- Make possible to check type of a InputFieldRef during runtime HOT 3
- How do I use relayMutationField & authField/withAuth work together? HOT 2
- Draft new release for `@pothos/tracing-sentry` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pothos.