Add TODO for typed parameters

This commit is contained in:
Jerko Steiner 2019-08-11 14:41:12 +07:00
parent fb4bb7b61b
commit d22f38ec92
2 changed files with 11 additions and 4 deletions

View File

@ -21,6 +21,10 @@ export interface IYear {
year: number
}
export interface ITyped<T> {
value: T
}
type AorB = 'A' | 'B'
export class Person {
@ -40,3 +44,9 @@ export class Person {
export class Employee extends Person {
duties: string[] = []
}
export class Typed<A, B extends 'string', C = 'number'> {
a!: ITyped<A>
b!: ITyped<B>
c!: ITyped<C>
}

View File

@ -184,10 +184,6 @@ function delint(sourceFile: ts.SourceFile) {
function delintNode(node: ts.Node) {
// TODO check which classes are exported
// TODO check which interfaces are in use
// TODO check which type references are in use in addition to the
// primitives like string, string[], number, number[], boolean,
// boolean[]
// TODO use typeParameters, for example type A<B> = Array<B>
switch (node.kind) {
case ts.SyntaxKind.InterfaceDeclaration:
@ -207,6 +203,7 @@ function delint(sourceFile: ts.SourceFile) {
throw new Error('no class name: ' + cls.pos)
break
}
console.log('type params', cls.typeParameters)
console.log(cls.name.escapedText, processClassMembers(cls.members))
}
ts.forEachChild(node, delintNode)