microsoft / microsoft/TypeScript

API: expose IntrinsicType

Open
#22,269 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Domain: API In Discussion Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

TypeScript Version: 2.7.2, 2.8.0-dev.20180228

Search Terms: IntrinsicType

There's currently no (official) way to distinguish the literal types true and false.

Although ts.TypeFlags.BooleanLiteral is included in ts.TypeFlags.Literal it's no ts.LiteralType. Therefore I cannot access the value of the literal. I need access to the internal ts.IntrinsicType for that.

TSLint just declared the type in their project, which might break at any time...

My current workaround is checker.typeToString(type) === 'false'.

If you expose ts.IntrinsicType, does it make sense to expose ts.TypeFlags.Intrisic too?

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 public ts.TypeFlags and ts.IntrinsicType declarations, then inspect the checker behavior represented by the typeToString workaround. Done means consumers can access the boolean-literal value through an official IntrinsicType API, with the TypeFlags question resolved and relevant compiler checks updated.

Written by the indexing model from the issue text.

Assessment

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