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

Change 'isSpecified*' & 'isIntrospectionType' accept only correct types #2196

Merged
merged 1 commit into from
Oct 1, 2019

Conversation

IvanGoncharov
Copy link
Member

Fixes #2153
Previous disscussion: #1837 (comment)

@IvanGoncharov IvanGoncharov added the PR: breaking change 💥 implementation requires increase of "major" version number label Sep 24, 2019
@IvanGoncharov
Copy link
Member Author

An alternative solution to #2194
I feel like we made a mistake in designing isSpecifiedDirective, isSpecifiedScalarType and isIntrospectionType predicates because we mixed type refinement and value refinement. For example in case of isSpecifiedScalarType we are mixing type instanceof GraphQLScalarType(refines type) and type.name === ...(refines value).
So I think #2153 is not unique to TS but a symptom of the general problem here.

@tgriesser Would be great to get your opinion?
@Cito We already discussed isSpecifiedDirective in #1837 would be great to get your opinion on this change?

@IvanGoncharov
Copy link
Member Author

Also, we have other value predicates for example isRequeiredArgument:

export function isRequiredArgument(arg: GraphQLArgument): boolean %checks {
return isNonNullType(arg.type) && arg.defaultValue === undefined;
}

export function isRequiredInputField(
field: GraphQLInputField,
): boolean %checks {
return isNonNullType(field.type) && field.defaultValue === undefined;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: breaking change 💥 implementation requires increase of "major" version number
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TS: isSpecifiedScalarType incorrectly refines type
1 participant