microsoft / microsoft/DefinitelyTyped-tools

.d.ts files should be forbidden from importing .ts files

Open
#641 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
423
Forks
237
Avg merge
18h 18m
Merged PRs (30d)
11

Description

.d.ts files should not be able to import .ts files; .ts files are supposed to be only for testing. But it's too easy to make a mistake and use .ts for a file intended for shipping types. See for example https://discord.com/channels/508357248330760243/757992230077333655/1086956594736148511

To repro:

cd $dt/types/adobe__pdfservices-node-sdk
git mv client-config.d.ts client-config.ts
npm test adobe__pdfservices-node-sdk

Expected: Error "Index.d.ts can't import from client-config.ts because it's a .ts file"
Actual: Compile error because client-config.ts uses syntax that is illegal in .ts (function signature without declare or following implementation signature).

Contributor guide

No contributing guide indexed for this repository

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

In types/adobe__pdfservices-node-sdk, run npm test adobe__pdfservices-node-sdk after renaming client-config.d.ts to client-config.ts as shown. Trace the validation around Index.d.ts and the renamed client-config.ts, then make the test report the expected import error instead of the current compile error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.