diff --git a/lib/node_modules/@stdlib/_tools/scripts/create_namespace_types.js b/lib/node_modules/@stdlib/_tools/scripts/create_namespace_types.js index d7bcf4aaae8c..fa804cda407f 100644 --- a/lib/node_modules/@stdlib/_tools/scripts/create_namespace_types.js +++ b/lib/node_modules/@stdlib/_tools/scripts/create_namespace_types.js @@ -100,7 +100,7 @@ function createTestFile() { * @returns {string} `index.d.ts` contents */ function createDefinitionFile( ns, imports, properties, description ) { - return [ + var lines = [ '/*', '* @license Apache-2.0', '*', @@ -121,16 +121,23 @@ function createDefinitionFile( ns, imports, properties, description ) { '', '// TypeScript Version: 4.1', '', - '/* eslint-disable max-lines */', - '', - imports.join( '\n' ), - '', + '/* eslint-disable max-lines' + ( ( properties.length === 0 ) ? ', @typescript-eslint/no-empty-interface' : '' ) + ' */', + '' + ]; + if ( imports.length > 0 ) { + lines.push( '', imports.join( '\n' ), '' ); + } + lines = lines.concat([ '/**', '* Interface describing the `'+ns+'` namespace.', - '*/', - 'interface Namespace {', - properties.join( '\n' ), - '}', + '*/' + ]); + if ( properties.length > 0 ) { + lines.push( 'interface Namespace {', properties.join( '\n' ), '}' ); + } else { + lines.push( 'interface Namespace {}' ); + } + lines = lines.concat([ '', '/**', '* '+description, @@ -142,7 +149,8 @@ function createDefinitionFile( ns, imports, properties, description ) { '', 'export = ns;', '' - ].join( '\n' ); + ]); + return lines.join( '\n' ); } /**