33 *
44 * This source code is licensed under the MIT license found in the
55 * LICENSE file in the root directory of this source tree.
6- *
7- * @flow
86 */
97
10- import detectNewline from 'detect-newline' ;
118import { EOL } from 'os' ;
9+ import detectNewline from 'detect-newline' ;
1210
13- type Pragmas = { [ key : string ] : string | string [ ] , __proto__ : null } ;
11+ type Pragmas = { [ key : string ] : string | string [ ] } ;
1412
1513const commentEndRe = / \* \/ $ / ;
1614const commentStartRe = / ^ \/ \* \* / ;
@@ -37,7 +35,7 @@ export function parse(docblock: string): Pragmas {
3735
3836export function parseWithComments (
3937 docblock : string ,
40- ) : { comments: string , pragmas : Pragmas } {
38+ ) : { comments : string ; pragmas : Pragmas } {
4139 const line = detectNewline ( docblock ) || EOL ;
4240
4341 docblock = docblock
@@ -67,7 +65,7 @@ export function parseWithComments(
6765 typeof result [ match [ 1 ] ] === 'string' ||
6866 Array . isArray ( result [ match [ 1 ] ] )
6967 ) {
70- result [ match [ 1 ] ] = [ ] . concat ( result [ match [ 1 ] ] , nextPragma ) ;
68+ result [ match [ 1 ] ] = ( [ ] as string [ ] ) . concat ( result [ match [ 1 ] ] , nextPragma ) ;
7169 } else {
7270 result [ match [ 1 ] ] = nextPragma ;
7371 }
@@ -79,9 +77,8 @@ export function print({
7977 comments = '' ,
8078 pragmas = { } ,
8179} : {
82- comments ?: string ,
83- pragmas ?: Pragmas ,
84- __proto__ : null ,
80+ comments ?: string ;
81+ pragmas ?: Pragmas ;
8582} ) : string {
8683 const line = detectNewline ( comments ) || EOL ;
8784 const head = '/**' ;
@@ -122,6 +119,8 @@ export function print({
122119 ) ;
123120}
124121
125- function printKeyValues ( key , valueOrArray ) {
126- return [ ] . concat ( valueOrArray ) . map ( value => `@${ key } ${ value } ` . trim ( ) ) ;
122+ function printKeyValues < T > ( key : string , valueOrArray : T | T [ ] ) {
123+ return ( [ ] as T [ ] )
124+ . concat ( valueOrArray )
125+ . map ( value => `@${ key } ${ value } ` . trim ( ) ) ;
127126}
0 commit comments