Skip to content

Commit

Permalink
Revert "[core] Widen signature of isTemplateDeclaration/isTemplateDec…
Browse files Browse the repository at this point in the history
…larationOrInstance" (#5538)

Reverts #5527
  • Loading branch information
witemple-msft authored Jan 8, 2025
1 parent 4293d23 commit 32a26c5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking
changeKind: internal
packages:
- "@typespec/compiler"
---

Revert "[core] Widen signature of isTemplateDeclaration/isTemplateDeclarationOrInstance"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
changeKind: feature
changeKind: internal
packages:
- "@typespec/compiler"
---
Expand Down
8 changes: 3 additions & 5 deletions packages/compiler/src/core/type-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export function isDeclaredType(type: Type): boolean {
* Resolve if the type is a template type declaration(Non initialized template type).
*/
export function isTemplateDeclaration(
type: Type,
type: TemplatedType,
): type is TemplatedType & { node: TemplateDeclarationNode } {
if (type.node === undefined) {
return false;
Expand All @@ -129,16 +129,14 @@ export function isTemplateDeclaration(
return (
node.templateParameters &&
node.templateParameters.length > 0 &&
(type as TemplatedType).templateMapper === undefined
type.templateMapper === undefined
);
}

/**
* Resolve if the type was created from a template type or is a template type declaration.
*/
export function isTemplateDeclarationOrInstance(
type: Type,
): type is TemplatedType & { node: TemplateDeclarationNode } {
export function isTemplateDeclarationOrInstance(type: TemplatedType): boolean {
if (type.node === undefined) {
return false;
}
Expand Down

0 comments on commit 32a26c5

Please sign in to comment.