Skip to content

Compiler API: @template tags do not set the constraint property on their type parametersย #55619

@Gerrit0

Description

@Gerrit0

๐Ÿ”Ž Search Terms

compiler api, template tag, jsdoc constraint

๐Ÿ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about the compiler API

โฏ Playground Link

https://ts-ast-viewer.com/#code/PQKhCgAIUgBAXApgWwA4BsCGTIG8B2ArsgEaIBOAvpACpQwICeqiAJogGZ43U3Nv1gQA

๐Ÿ’ป Code

/**
 * @template {number} T
 * @typedef {T} Typed
 */

๐Ÿ™ Actual behavior

templateTag.typeParameters[0].constraint is undefined

๐Ÿ™‚ Expected behavior

templateTag.typeParameters[0].constraint should be a number type, the equivalent TS type parameter works as expected:

type Typed<T extends number> = T

Additional information about the issue

I mentioned this in the TS Discord, @jakebailey confirmed it looks like a likely bug

Originally reported in: TypeStrong/typedoc#2384

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions