import ts from 'typescript' ; import { TypeParameter } from '../Components/TypeParameter' ; export namespace TypeParameterFactory { export function getConstraint ( memberDeclaration , checker ) { const effectiveConstraint = ts . getEffectiveConstraintOfTypeParameter ( < ts . TypeParameterDeclaration > memberDeclaration ) ; if ( effectiveConstraint === undefined ) { return ; } return checker . typeToString ( checker . getTypeFromTypeNode ( effectiveConstraint ) ) ; } export function create ( signature , namedDeclaration , checker ) { const result = new TypeParameter ( signature . getName ( ) ) ; result . constraint = getConstraint ( namedDeclaration , checker ) ; return result ; } }