import * as ts from "typescript" ; import { getType } from "./helpers" ; import getTypeCall from "./getTypeCall" ; import { PropertyDescriptionSource } from "./declarations" ; import { getDecorators } from "./getDecorators" ; import { Context } from "./contexts/Context" ; param symbol param type param context export function getProperties ( symbol , type , context ) { if ( symbol ?. members ) { const members = Array . from ( symbol . members . values ( ) as any ) ; const properties = members . filter ( m => ( m . flags & ts . SymbolFlags . Property ) == ts . SymbolFlags . Property || ( m . flags & ts . SymbolFlags . GetAccessor ) == ts . SymbolFlags . GetAccessor ) . map ( ( memberSymbol ) => { return { n : memberSymbol . escapedName . toString ( ) , t : getTypeCall ( getType ( memberSymbol , context . typeChecker ) , memberSymbol , context ) , d : getDecorators ( memberSymbol , context . typeChecker ) } ; } ) ; return properties . length ? properties : undefined ; } const resolvedTypeArguments = context . typeChecker . getTypeArguments ( type as ts . TypeReference ) ; if ( resolvedTypeArguments ) { const properties = resolvedTypeArguments . map ( ( type , index ) => { return { n : index . toString ( ) , t : getTypeCall ( type , undefined , context ) } ; } ) ; return properties . length ? properties : undefined ; } return undefined ; }