@ -53,7 +53,7 @@ function generatePrefixed(prefix) {
if ( hasChildren ( parts ) ) {
if ( hasChildren ( parts ) ) {
chain = parts . join ( '_' ) + '<T>' ;
chain = parts . join ( '_' ) + '<T>' ;
} else {
} else {
// t his is a single function, not a namespace, so there's no type associated
// T his is a single function, not a namespace, so there's no type associated
// and we need to dereference it as a property type
// and we need to dereference it as a property type
const last = parts . pop ( ) ;
const last = parts . pop ( ) ;
const joined = parts . join ( '_' ) ;
const joined = parts . join ( '_' ) ;
@ -77,7 +77,7 @@ function generatePrefixed(prefix) {
output += ` \t ${ part } : RegisterBase<T> ` ;
output += ` \t ${ part } : RegisterBase<T> ` ;
if ( hasChildren ( parts ) ) {
if ( hasChildren ( parts ) ) {
// t his chain can be continued, make the property an intersection type with the chain continuation
// T his chain can be continued, make the property an intersection type with the chain continuation
const joined = parts . join ( '_' ) ;
const joined = parts . join ( '_' ) ;
output += ` & Register_ ${ joined } <T> ` ;
output += ` & Register_ ${ joined } <T> ` ;
}
}
@ -96,7 +96,7 @@ function generatePrefixed(prefix) {
const typeBody = ` { \n ${ output } } \n ${ children } ` ;
const typeBody = ` { \n ${ output } } \n ${ children } ` ;
if ( prefix . length === 0 ) {
if ( prefix . length === 0 ) {
// n o prefix, so this is the type for the default export
// N o prefix, so this is the type for the default export
return ` export interface Register<T> extends RegisterBase<T> ${ typeBody } ` ;
return ` export interface Register<T> extends RegisterBase<T> ${ typeBody } ` ;
}
}
const namespace = [ 'Register' ] . concat ( prefix ) . join ( '_' ) ;
const namespace = [ 'Register' ] . concat ( prefix ) . join ( '_' ) ;
@ -148,7 +148,7 @@ function verify(parts, asPrefix) {
// Returns true if a chain can have any child properties
// Returns true if a chain can have any child properties
function hasChildren ( parts ) {
function hasChildren ( parts ) {
// c oncatenate the chain with each other part, and see if any concatenations are valid functions
// C oncatenate the chain with each other part, and see if any concatenations are valid functions
const validChildren = allParts
const validChildren = allParts
. filter ( newPart => parts . indexOf ( newPart ) === - 1 )
. filter ( newPart => parts . indexOf ( newPart ) === - 1 )
. map ( newPart => parts . concat ( [ newPart ] ) )
. map ( newPart => parts . concat ( [ newPart ] ) )