-
-
Notifications
You must be signed in to change notification settings - Fork 669
[Implement] ReturnType #735
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
Conversation
Makes me wonder if we should rename
and maybe introduce
As for the error, perhaps
|
Yeah. I can work on those separately. They are all within my ability. Are there any other improvements I could make on this feature beside the error description? |
Also if we implement parameter count, won't that make emit() safer and faster with compile time constants? |
src/resolver.ts
Outdated
if (!signatureReference) { | ||
if (reportMode == ReportMode.REPORT) { | ||
this.error( | ||
DiagnosticCode.Index_signature_is_missing_in_type_0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Index signature is for something[xy]
overloads. Might be that the necessary error code is not in diagnosticMessages.json yet. If so, the process is to add it there and run scripts/build-diagnostics
to update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the tip. What should the first error be? The same thing?
I've submitted a commit that has both errors exactly the same.
src/resolver.ts
Outdated
@@ -565,7 +565,7 @@ export class Resolver extends DiagnosticEmitter { | |||
if (!(typeArgumentNodes && typeArgumentNodes.length == 1)) { | |||
if (reportMode == ReportMode.REPORT) { | |||
this.error( | |||
DiagnosticCode.Expected_0_type_arguments_but_got_1, | |||
DiagnosticCode.Type_0_has_no_call_signatures, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previous error message was correct in that it reports missing type arguments on the builtin itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Switched back.
Okay. I know I've submitted a lot of pull requests recently. I'm very flexible and can work on each one individually until everything is perfect for each one. Can you help me clean them off one by one? |
Of course, these are really useful PRs. The one thing I'm unsure about, as mentioned, is whether we should rename existing type-builtins to match the Type builtins
(are there any other special types TS provides, like ReturnType, that we might want to implement? perhaps: Code builtins
With all the renaming going on, it might make sense to join all of this to a single breaking PR instead of breaking just some stuff while waiting for additional PRs. Alternatively, this PR could do the necessary renaming together with |
I don't think we need to break anything at all. We can simply add some aliases for each type that was mis-named and support both. For instance, it would be nice not to have to break the entire As for combining all these pull requests into a single request, if you prefer it that way, let's go ahead and close these in favor of a single request with a bunch of builtins, types, and aliases. Here are the ones I propose we get out of the way first:
Some of the ones we should probably think about in seperate prs with some guidance:
|
closed in favor of #739 |
fixes #728
Questions:
valueof<T>
and adapted it)