import { TypeKind } from "tst-reflect/reflect" ; import * as ts from "typescript" ; import { TypeFlags } from "typescript" ; import { Context } from "./contexts/Context" ; import { TypeDescriptionResult } from "./declarations" ; import getTypeCall from "./getTypeCall" ; param type param context export function getNativeTypeDescription ( type , context ) { if ( ( type as any ) [ "intrinsicName" ] !== undefined ) { return { ok : true , typeDescription : { n : ( type as any ) . intrinsicName , k : TypeKind . Native , ctors : undefined , decs : undefined , props : undefined } } ; } if ( ( type . flags & TypeFlags . Object ) == TypeFlags . Object && type . getSymbol ( ) ?. escapedName == "Array" ) { const typeArguments = context . typeChecker . getTypeArguments ( type as ts . TypeReference ) ; if ( typeArguments . length == 1 ) { return { ok : true , typeDescription : { n : "Array" , k : TypeKind . Native , args : [ getTypeCall ( typeArguments [ 0 ] , undefined , context ) ] } } ; } } return { ok : false } ; }