microsoft / microsoft/TypeScript

"Generic type ' Example' requires 1 type argument(s)." ts(2314) not thrown in .d.ts file

Open
#42,817 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Domain: Something Else
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

Bug Report

🔎 Search Terms
  • generic type
  • ts 2314
  • .d.ts
🕗 Version & Regression Information
  • Versions I tried: I tried 3.3.3, 4.1.3 and 4.3.0-dev.20210216.
⏯ Playground Link

Repo link with relevant code

(Repo is small. TypeScript is the only dependency.)

💻 Code
export type Example = {
  _links: Links<>; // throws error in a .ts file, but not a .d.ts file
};
🙁 Actual behavior

No error thrown.

🙂 Expected behavior

Throw "Generic type ' Example' requires 1 type argument(s)." ts(2314).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked d-ts-bug-demo repository and reproduce the difference between the .ts and .d.ts examples using the reported TypeScript versions. Trace how the compiler handles the generic reference in declaration files, then verify that the expected ts(2314) diagnostic is produced without changing the valid .ts behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.