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

[core] Widen signature of isTemplateDeclaration/isTemplateDeclarationOrInstance #5527

Conversation

witemple-msft
Copy link
Member

@witemple-msft witemple-msft commented Jan 8, 2025

As described in #5447

This changes the signature of isTemplateDeclaration and isTemplateDeclarationOrInstance so that they accept any Type rather than just TemplatedType. This makes them consistent with isTemplateInstance.

isTemplateDeclarationOrInstance also gains a type guard to refine the input type when it returns true.

Closes #5447

@witemple-msft witemple-msft added the compiler:core Issues for @typespec/compiler label Jan 8, 2025
@azure-sdk
Copy link
Collaborator

All changed packages have been documented.

  • @typespec/compiler
Show changes

@typespec/compiler - feature ✏️

Widen type signature of isTemplateDeclaration and isTemplateDeclarationOrInstance to accept any type and assert the return type.

@azure-sdk
Copy link
Collaborator

You can try these changes here

🛝 Playground 🌐 Website 📚 Next docs 🛝 VSCode Extension

@witemple-msft witemple-msft added this pull request to the merge queue Jan 8, 2025
Merged via the queue into microsoft:main with commit 1536482 Jan 8, 2025
24 checks passed
@witemple-msft witemple-msft deleted the witemple-msft/widen-template-detect-sig branch January 8, 2025 19:44
github-merge-queue bot pushed a commit that referenced this pull request Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:core Issues for @typespec/compiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: isTemplateDeclaration and isTemplateDeclarationOrInstance take TemplatedType instead of just Type
4 participants