-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
The signature of certain functions do not match the signature of the implementation #55010
Comments
The internal signature is wrong, dangerous, and convenient, because they make negative implications that aren't correct (a thing that is not an We think this is a good trade-off for us, but not for people who aren't as familiar with TS as people who are working on TS itself. |
Could adding an |
@NilsIrl That won’t fix anything. The issue is that, if you say the return type is This is the same reason functions like |
The idea would then be to then the signature to this: interface ArrayType extends TypeReference {}
isArrayType(type: Type): type is ArrayType; Which means that if the function then returns false, it doesn't mean |
This issue has been marked as "Working as Intended" and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
Bug Report
Functions such as
isArrayType()
andisTupleType
have a different signature insrc/compiler/types.ts
and in the implementation insrc/checker/types.ts
.In
src/compiler/types.ts
:In
src/compiler/checker.ts
:This means that the post-condition of these functions cannot be made use of in external code.
🔎 Search Terms
🕗 Version & Regression Information
This was only an internal issue until these functions were exposed in #52467
💻 Code
🙁 Actual behavior
🙂 Expected behavior
The code example given compiles without issues.
PS: I have a PR ready to be submitted to fix it for these particular functions
The text was updated successfully, but these errors were encountered: