graphile / graphile/crystal

`extend type Foo` where Foo is actually an interface silently fails when it could give a better error

Open
#2,206 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
12.9k
Forks
625
Avg merge
5h 23m
Merged PRs (30d)
24

Description

Discord context: https://discord.com/channels/489127045289476126/498852330754801666/1292111166235082803

This is the code I tried to write:

```typescript
// comment on table app.users is $$
// @interface mode:relational type:kind
// @type MEMBER references:members
// @type ADMIN references:admins
// $$;

export const TestPlugin = makeExtendSchemaPlugin(() => {
return {
typeDefs: gql`
extend type User {
foo1: String
}

extend type Member {
foo2: String
}

extend type Admin {
foo3: String
}
`,
plans: {
User: {
// foo1 not in the schema.sql
foo1() {
return constant("bar");
},
},
Member: {
foo2() { // works
return constant("bar");
},
},
Admin: {
foo3() { // works
return constant("bar");
},
},
},
};
});
```

> That’s coz you’re using extend type which applies to object types; you want extend interface since it’s an interface.
>
> Please file an issue about this; we can be more helpful and throw an error on type mismatch. (Currently the type is never seen so the extension never triggers.)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.