1- import * as ts from 'typescript' ;
1+ import ts from 'typescript' ;
22import * as path from 'path' ;
33import * as fs from 'fs' ;
44import chalk from 'chalk' ;
55import { Application , TypeDocReader , TSConfigReader , ProjectReflection , DeclarationReflection , Reflection } from 'typedoc' ;
66
7- import { highlight } from './html-loader/highlight' ;
8- import { hashCode } from './utils/hash-code' ;
7+ import { highlight } from './html-loader/highlight.mjs ' ;
8+ import { hashCode } from './utils/hash-code.mjs ' ;
99const { readFile, mkdir, writeFile } = fs . promises ;
1010
1111interface PkgSymbol {
@@ -56,9 +56,9 @@ async function render() {
5656 if ( ! child . children ) {
5757 continue ;
5858 }
59- let pkgName = child . sources ! [ 0 ] . fileName . replace ( / s r c \/ l i b / , '@alyle/ui' ) ;
59+ let pkgName = child . sources ! [ 0 ] ! . fileName . replace ( / s r c \/ l i b / , '@alyle/ui' ) ;
6060 pkgName = path . dirname ( pkgName ) ;
61- console . log ( child . sources ! [ 0 ] . fileName ) ;
61+ console . log ( child . sources ! [ 0 ] ! . fileName ) ;
6262 pkgName = pkgName . endsWith ( '/' ) ? pkgName . slice ( 0 , - 1 ) : pkgName ;
6363 console . log ( chalk . greenBright ( `\nPackage: ${ pkgName } ` ) ) ;
6464 let API = APIList . find ( api => api . pkg === pkgName ) ;
@@ -74,19 +74,19 @@ async function render() {
7474 APIList . push ( API ) ;
7575 }
7676 for ( const _child of child . children ) {
77- const file = _child . sources ! [ 0 ] . fileName ;
77+ const file = _child . sources ! [ 0 ] ! . fileName ;
7878 const { name, decorators, kindString } = _child ;
7979 const type = decorators
80- ? decorators [ 0 ] . name
80+ ? decorators [ 0 ] ! . name
8181 : ( kindString ! === 'Variable' ? 'Const' : kindString ! ) ;
8282 const symbol = hasTag ( _child , 'decorator' )
8383 ? 'Decorator'
8484 : decorators
85- ? decorators [ 0 ] . name
85+ ? decorators [ 0 ] ! . name
8686 : _child . flags . isConst
8787 ? 'Const'
8888 : ( kindString ! === 'Variable' ? 'Const' : kindString ! ) ;
89- const Type = `${ toCamelcase ( type ) } List` ;
89+ // const Type = `${toCamelcase(type)}List`;
9090 if (
9191 ! checkIfContainTagPrivate ( _child ) && ! hasTag ( _child , 'docsPrivate' ) && ! name . startsWith ( '_' )
9292 ) {
@@ -206,6 +206,7 @@ async function render() {
206206 await generateJson ( ) ;
207207 await render ( ) ;
208208} ) ( ) . catch ( ( error ) => {
209+ console . log ( error ) ;
209210 throw new Error ( error ) ;
210211} ) ;
211212
@@ -217,7 +218,7 @@ function groupBy<T>(xs: T[], key: string): { key: string, items: T[]}[] {
217218 items : [ ]
218219 } ) as true /** <-- This always returns true, since an item is never removed */ )
219220 && rv [ rv . length - 1 ] ) ;
220- item . items . push ( x ) ;
221+ item ! . items . push ( x ) ;
221222 return rv ;
222223 } , [ ] as { key : string , items : T [ ] } [ ] ) ;
223224}
@@ -256,7 +257,7 @@ function toCamelcase(str: string) {
256257
257258function hasTag ( refl : DeclarationReflection , tag : string ) : boolean {
258259 const comment : Reflection [ 'comment' ] = refl . comment
259- || ( refl [ 'signatures' ] && refl [ 'signatures' ] . length ? refl [ 'signatures' ] [ 0 ] . comment : undefined ) ;
260+ || ( refl [ 'signatures' ] && refl [ 'signatures' ] . length ? refl [ 'signatures' ] [ 0 ] ! . comment : undefined ) ;
260261 if ( comment && comment . tags ) {
261262 return comment . tags . some ( ( _ : any ) => _ . tag === tag ) ;
262263 } else {
@@ -266,7 +267,7 @@ function hasTag(refl: DeclarationReflection, tag: string): boolean {
266267
267268function checkIfContainTagPrivate ( refl : DeclarationReflection ) : boolean {
268269 const comment : Reflection [ 'comment' ] = refl . comment
269- || ( refl [ 'signatures' ] && refl [ 'signatures' ] . length ? refl [ 'signatures' ] [ 0 ] . comment : undefined ) ;
270+ || ( refl [ 'signatures' ] && refl [ 'signatures' ] . length ? refl [ 'signatures' ] [ 0 ] ! . comment : undefined ) ;
270271 if ( comment && comment . tags ) {
271272 return comment . tags . some ( ( _ : any ) => _ . tag === 'docs-private' ) ;
272273 } else {
0 commit comments