microsoft / microsoft/TypeScript

API: incorrect declarations in types.ts

Open
#24,706 5 comments 12 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Breaking Change Help Wanted Infrastructure
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

The --strictNullChecks PR changed some declarations in types.ts to avoid frequent assertions in the compiler's code. Unfortunately these changes make it really unsafe for API users because they no longer contain the actually nullable types: https://github.com/Microsoft/TypeScript/pull/22088#discussion_r184149465 https://github.com/Microsoft/TypeScript/pull/22088#discussion_r184155027

  • ts.Node#parent is no longer optional (which is definitely wrong for SourceFile)
  • ts.Symbol#declarations and ts.Symbol.valueDeclaration are no longer optional, but can still be undefined
  • ts.Type#symbol is no longer optional, but I guess this comment is still up to date: // Symbol associated with type (if any)

These changes should either be reverted or replaced in the published declaration files.
/cc @andy-ms @weswigham

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 declarations in types.ts and review the linked discussions about the strictNullChecks changes. Check the published declaration files for ts.Node#parent, ts.Symbol#declarations, ts.Symbol.valueDeclaration, and ts.Type#symbol. Done means these declarations accurately allow the nullable or absent values described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Bug
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.