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

Compiler API: Expose signature.thisParameter #48144

Closed
5 tasks done
Gerrit0 opened this issue Mar 6, 2022 · 2 comments · Fixed by #53628
Closed
5 tasks done

Compiler API: Expose signature.thisParameter #48144

Gerrit0 opened this issue Mar 6, 2022 · 2 comments · Fixed by #53628
Labels
In Discussion Not yet reached consensus Suggestion An idea for TypeScript

Comments

@Gerrit0
Copy link
Contributor

Gerrit0 commented Mar 6, 2022

Suggestion

Remove @internal for the thisParameter on the Signature interface.

/* @internal */
thisParameter?: Symbol; // symbol of this-type parameter

🔍 Search Terms

compiler api, thisParameter

✅ Viability Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

⭐ Suggestion

As above.

📃 Motivating Example

TypeDoc needs to access the this parameter to properly document functions via their signature rather than relying on nodes. Today, I plan to add this to a declaration file to expose it manually. TypeStrong/typedoc#1875

@RyanCavanaugh RyanCavanaugh added In Discussion Not yet reached consensus Suggestion An idea for TypeScript labels Mar 8, 2022
@RyanCavanaugh
Copy link
Member

@ahejlsberg any concerns? I'm inclined to approve

Gerrit0 added a commit to Gerrit0/TypeScript that referenced this issue Apr 2, 2023
@sandersn
Copy link
Member

It's just another parameter, so I think it should be public just like parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
In Discussion Not yet reached consensus Suggestion An idea for TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants