Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add satisfies type assertion for typescript #4797

Closed
wants to merge 4 commits into from

Conversation

drewatk
Copy link
Contributor

@drewatk drewatk commented Sep 18, 2024

Fixes #4772

Adds a satisfies assertion to the live resolver import:

import {User as userRelayModelInstanceResolverType} from "UserTypeResolvers";
// Type assertion validating that `userRelayModelInstanceResolverType` resolver is correctly implemented.
// A type error here indicates that the type signature of the resolver module is incorrect.
(userRelayModelInstanceResolverType satisfies (
  id: User__id$data['id'],
  args: void,
) => LiveState<mixed>);

It will also require a minimum Typescript version of TS 4.9 or higher for consumers, which can be checked as we implement #4755. We may have to have add a feature flag to disable this for consumers of the library which do not meet this minimum standard.

@drewatk drewatk marked this pull request as ready for review September 18, 2024 18:43
@captbaritone
Copy link
Contributor

Nice!!

@facebook-github-bot
Copy link
Contributor

@captbaritone has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@captbaritone merged this pull request in 575f206.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Typescript Validation for Resolver Types
3 participants