You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cannot write linter code that handles the types irrespective of whether it is a generic or ordinary type, due to no way to map an unconstrained generic to an intrinsic unknown type object
🔍 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: