Skip to content

Commit

Permalink
fix(cli): ExternalObject type decalare
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Nov 21, 2021
1 parent 4874c72 commit 1f64f9f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
10 changes: 7 additions & 3 deletions cli/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,13 @@ async function processIntermediateTypeFile(
.split('\n')
.map((line) => line.trim())
.filter(Boolean)
let dts = `export class ExternalObject<T> {
private readonly __type: unique symbol;
[val: unique symbol]: T
let dts = `/* eslint-disable */
export class ExternalObject<T> {
readonly '': {
readonly '': unique symbol
[K: symbol]: T
}
}\n`
const classes = new Map<string, string>()
const impls = new Map<string, string>()
Expand Down
10 changes: 7 additions & 3 deletions examples/napi/__test__/typegen.spec.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ Generated by [AVA](https://avajs.dev).

> Snapshot 1
`export class ExternalObject<T> {␊
private readonly __type: unique symbol;␊
[val: unique symbol]: T␊
`/* eslint-disable */␊
export class ExternalObject<T> {␊
readonly '': {␊
readonly '': unique symbol␊
[K: symbol]: T␊
}␊
}␊
export const DEFAULT_COST: number␊
export function getWords(): Array<string>␊
Expand Down
Binary file modified examples/napi/__test__/typegen.spec.ts.snap
Binary file not shown.
8 changes: 6 additions & 2 deletions examples/napi/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
/* eslint-disable */

export class ExternalObject<T> {
private readonly __type: unique symbol;
[val: unique symbol]: T
readonly '': {
readonly '': unique symbol
[K: symbol]: T
}
}
export const DEFAULT_COST: number
export function getWords(): Array<string>
Expand Down

0 comments on commit 1f64f9f

Please sign in to comment.