Merge pull request #1149 from napi-rs/multi-impl-typedef

fix(cli): generated type def on multi impl blocks
This commit is contained in:
LongYinan 2022-04-26 18:21:35 +08:00 committed by GitHub
commit 8ae06dccc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 1 deletions

View file

@ -592,7 +592,11 @@ async function processIntermediateTypeFile(
})
break
case 'impl':
impls.set(def.name, `${def.js_doc}${def.def}`)
const existed = impls.get(def.name)
impls.set(
def.name,
`${existed ? existed + '\n' : ''}${def.js_doc}${def.def}`,
)
break
case 'interface':
dts +=

View file

@ -217,6 +217,7 @@ Generated by [AVA](https://avajs.dev).
export type Blake2bHasher = Blake2BHasher␊
/** Smoking test for type generation */␊
export class Blake2BHasher {␊
static withKey(key: Blake2bKey): Blake2BHasher␊
update(data: Buffer): void␊
}␊
export type Blake2bKey = Blake2BKey␊

View file

@ -207,6 +207,7 @@ export class Bird {
export type Blake2bHasher = Blake2BHasher
/** Smoking test for type generation */
export class Blake2BHasher {
static withKey(key: Blake2bKey): Blake2BHasher
update(data: Buffer): void
}
export type Blake2bKey = Blake2BKey