Typescript issues when reusing definitions in ObjectDefinition and InputDefinition
See original GitHub issueIn 1.0.0
version, I was able to reuse definitions for both objectType
and inputObjectType
like so:
const experienceFieldsDefinition = (t: ObjectDefinitionBlock<any> | InputDefinitionBlock<any>) => {
t.nonNull.string("position");
// Next line produces compilation error in `1.1.0`
t.field("employmentType", {
type: EmploymentTypeEnumType
});
});
const ExperienceType = objectType({
name: "Experience",
definition(t) {
t.nonNull.objectId("_id");
experienceFieldsDefinition(t);
}
});
const ExperienceInput = inputObjectType({
name: "ExperienceInput",
definition(t) {
experienceFieldsDefinition(t);
}
});
After upgrading to 1.1.0
, t.field(...)
gives the following error:
This expression is not callable.
Each member of the union type '{ <FieldName extends string>(name: FieldName, config: FieldOutConfig<any, FieldName>): void; <FieldName extends string>(config: FieldOutConfigWi
thName<any, FieldName>): void; } | { ...; }' has signatures, but none of those signatures are compatible with each other.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Reuse a function type's argument definition - Stack Overflow
In typescript is there a way to reuse parameter types as follows: interface Box { create: (paramToReuse: (value: any) => void) => void ......
Read more >has signatures, but none of those signatures are compatible ...
Your problem is that the type of desc is ABC[] | DEF[] . ... issues when reusing definitions in ObjectDefinition and InputDefinition#943.
Read more >TypeScript - Objects - Tutorialspoint
An object is an instance which contains set of key value pairs. The values can be scalar values or functions or even array...
Read more >How to reuse object types on variables in TypeScript?
To understand it better, let's see a problem we might face while working with TypeScript. For example, let's say we have a variable...
Read more >Technology and Human Issues in Reusing Learning Objects
The reuse of digital learning material has been an issue for more than two decades (Collis, ... For example in terms of the...
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
Any workaround or update on this and seeing this myself still in the latest version ?
Yep probably, will try to check this out tomorrow or Friday.