@@ -67,6 +67,13 @@ function extractNamespaceTypes(sourcePath, overrides) {
6767 const sourceFile = program . getSourceFile ( sourcePath ) ;
6868 const types = [ ] ;
6969
70+ if ( ! sourceFile ) {
71+ throw new Error (
72+ `Unable to read generated namespace declarations at ${ sourcePath } . ` +
73+ "Run `make types` from the repository root first." ,
74+ ) ;
75+ }
76+
7077 function visit ( node , inNgNamespace = false ) {
7178 if ( ts . isModuleDeclaration ( node ) ) {
7279 const nextInNgNamespace =
@@ -127,6 +134,7 @@ function collectMembers(checker, overrides, typeName, type) {
127134 const declaration = property . valueDeclaration ?? property . declarations ?. [ 0 ] ;
128135
129136 if ( property . name === "__type" || ! isRepoTypesNode ( declaration ) ) continue ;
137+ if ( ! isPublicDeclaration ( declaration ) ) continue ;
130138 if ( skippedByOverride ( typeName , property . name , manual , unsupported ) ) continue ;
131139
132140 const propertyType = checker . getTypeOfSymbolAtLocation ( property , declaration ) ;
@@ -323,6 +331,14 @@ function isRepoTypesNode(node) {
323331 ) ;
324332}
325333
334+ function isPublicDeclaration ( node ) {
335+ return ! node . modifiers ?. some (
336+ ( modifier ) =>
337+ modifier . kind === ts . SyntaxKind . PrivateKeyword ||
338+ modifier . kind === ts . SyntaxKind . ProtectedKeyword ,
339+ ) ;
340+ }
341+
326342if ( process . argv [ 1 ] === new URL ( import . meta. url ) . pathname ) {
327343 fs . mkdirSync ( path . dirname ( outputPath ) , { recursive : true } ) ;
328344 fs . writeFileSync ( outputPath , generateBindings ( ) ) ;
0 commit comments