microsoft / microsoft/TypeScript

Docs - I am able to add new add new items to top level scope, contrary to what doc mention.

Open
#37,145 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Docs
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

Search Terms: Documentation

Typescript Version: 3.5.3

Documentation here and here mention, "Neither module augmentations nor global augmentations can add new items to the top level scope - they can only “patch” existing declarations.", however I am able to "add new items".

//file-a.ts
import * as moment from 'moment';
declare module "moment" {
  interface GoblyGoop {
      name: string;
  }
}
let y: moment.GoblyGoop;

//file-b.ts
import * as moment from 'moment';
let y: moment.GoblyGoop;

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

Read the linked sections on augmenting global/module scope and declaration merging, then reproduce the TypeScript 3.5.3 example using file-a.ts and file-b.ts. Confirm whether the example contradicts the documented limitation, and update the relevant handbook wording or add an explanation so the documented behavior matches the result.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 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.