From 472c7b3574e7a17102b3314b438305a79526b6d2 Mon Sep 17 00:00:00 2001 From: Jerko Steiner Date: Sun, 11 Aug 2019 22:19:49 +0700 Subject: [PATCH] Figure out how to determine class type parameters --- packages/scripts/src/commands/typecheck.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/scripts/src/commands/typecheck.ts b/packages/scripts/src/commands/typecheck.ts index 2d3a5a8..aa5c194 100644 --- a/packages/scripts/src/commands/typecheck.ts +++ b/packages/scripts/src/commands/typecheck.ts @@ -64,6 +64,21 @@ export function typecheck() { // } const type = checker.getDeclaredTypeOfSymbol(symbol) + + if (type.isClassOrInterface() && type.typeParameters) { + type.typeParameters.forEach(tp => { + console.log('tp.symbol.name', tp.symbol.name) + const constraint = tp.getConstraint() + if (constraint) { + console.log('tp.constraint', checker.typeToString(constraint)) + } + const def = tp.getDefault() + if (def) { + console.log('tp.default', checker.typeToString(def)) + } + }) + } + // const properties = checker.getPropertiesOfType(type) const properties = type.getApparentProperties()