Add support for question tokens in typecheck.ts

This commit is contained in:
Jerko Steiner 2019-08-12 09:08:13 +07:00
parent e55738f547
commit 0ce76eb648

View File

@ -32,6 +32,11 @@ export function typecheck() {
}
return
function getAllTypeParameters(type: ts.Type) {
// checker.typeToTypeNode
// ts.isParameterPropertyDeclaration(type.
// if (type.
}
/** visit nodes finding exported classes */
function visit(node: ts.Node) {
@ -76,14 +81,34 @@ export function typecheck() {
return !(flags & ts.ModifierFlags.NonPublicAccessibilityModifier)
})
.map(p => {
const vd = p.valueDeclaration
const questionToken = ts.isPropertyDeclaration(vd) && !!vd.questionToken
const propType = checker
.getTypeOfSymbolAtLocation(p, p.valueDeclaration)
const s = propType.getSymbol()
if (s) {
// if (ts,
// console.log(' ', p.getName(), checker.getFullyQualifiedName(s))
// s.value
// checker.
// const d = s.getDeclarations()
// if (d) {
// d.forEach(dec => {
// console.log(' ', dec.getText())
// })
// }
}
p.flags
return {
name: p.getName(),
type: checker.typeToString(propType),
classOrIface: propType.isClassOrInterface(),
union: propType.isUnion(),
questionToken,
// classOrIface: propType.isClassOrInterface(),
// union: propType.isUnion(),
}
}))
// output.push(serializeClass(symbol))