Add getUnknownType
to checker
api
#60475
Labels
Committed
The team has roadmapped this issue
Help Wanted
You can do this
Suggestion
An idea for TypeScript
Milestone
🔍 Search Terms
unknown, ts api, type relationship api,
✅ Viability Checklist
⭐ Suggestion
I would like to add a method to the checker api to get an intrinsic unknown type.
const checker: TypeChecker = { // ... getAnyType: () => anyType, + getUnknownType: () => unknownType, getStringType: () => stringType, // ... }
📃 Motivating Example
I want to write a function that looks roughly like
for use in typescript-eslint (see the utility function
getConstrainedTypeAtLocation
, which currently cannot be used to resolve typescript-eslint/typescript-eslint#10314 (comment), due to an unconstrained generic not returning anunknown
type with that utility's current implementation)I'm happy to submit a PR to make this change.
💻 Use Cases
unknown
type objectThe text was updated successfully, but these errors were encountered: