diff --git a/crates/backend/src/typegen.rs b/crates/backend/src/typegen.rs index b17907a6..123f6dc9 100644 --- a/crates/backend/src/typegen.rs +++ b/crates/backend/src/typegen.rs @@ -115,14 +115,14 @@ static KNOWN_TYPES: Lazy> = Lazy::new(|| { ("u8", "number"), ("u16", "number"), ("u32", "number"), - ("u64", "BigInt"), - ("i64n", "BigInt"), - ("u128", "BigInt"), - ("i128", "BigInt"), - ("usize", "BigInt"), - ("isize", "BigInt"), - ("JsBigInt", "BigInt"), - ("BigInt", "BigInt"), + ("u64", "bigint"), + ("i64n", "bigint"), + ("u128", "bigint"), + ("i128", "bigint"), + ("usize", "bigint"), + ("isize", "bigint"), + ("JsBigInt", "bigint"), + ("BigInt", "bigint"), ("JsBoolean", "boolean"), ("bool", "boolean"), ("JsString", "string"), diff --git a/examples/napi-compat-mode/__test__/get-napi-version.spec.ts b/examples/napi-compat-mode/__test__/get-napi-version.spec.ts index 62fa68b8..c623c437 100644 --- a/examples/napi-compat-mode/__test__/get-napi-version.spec.ts +++ b/examples/napi-compat-mode/__test__/get-napi-version.spec.ts @@ -5,5 +5,5 @@ const bindings = require('../index.node') test('should get napi version', (t) => { const napiVersion = bindings.getNapiVersion() t.true(typeof napiVersion === 'number') - t.is(`${napiVersion}`, process.versions.napi) + t.is(`${napiVersion}`, process.versions.napi!) }) diff --git a/examples/napi/__test__/typegen.spec.ts.md b/examples/napi/__test__/typegen.spec.ts.md index 25d3615b..ec3e0649 100644 --- a/examples/napi/__test__/typegen.spec.ts.md +++ b/examples/napi/__test__/typegen.spec.ts.md @@ -27,9 +27,9 @@ Generated by [AVA](https://avajs.dev). export function sumNums(nums: Array): number␊ export function readFileAsync(path: string): Promise␊ export function asyncMultiTwo(arg: number): Promise␊ - export function bigintAdd(a: BigInt, b: BigInt): BigInt␊ - export function createBigInt(): BigInt␊ - export function createBigIntI64(): BigInt␊ + export function bigintAdd(a: bigint, b: bigint): bigint␊ + export function createBigInt(): bigint␊ + export function createBigIntI64(): bigint␊ export function getCwd(callback: (arg0: string) => void): void␊ /** napi = { version = 2, features = ["serde-json"] } */␊ export function readFile(callback: (arg0: Error | undefined, arg1?: string | undefined | null) => void): void␊ @@ -69,7 +69,7 @@ Generated by [AVA](https://avajs.dev). export function getExternal(external: ExternalObject): number␊ export function mutateExternal(external: ExternalObject, newVal: number): void␊ export function tsRename(a: { foo: number }): string[]␊ - export function xxh64Alias(input: Buffer): BigInt␊ + export function xxh64Alias(input: Buffer): bigint␊ export function getMapping(): Record␊ export function sumMapping(nums: Record): number␊ export function mapOption(val?: number | undefined | null): number | undefined | null␊ @@ -207,19 +207,19 @@ Generated by [AVA](https://avajs.dev). }␊ export namespace xxh3 {␊ export const ALIGNMENT: number␊ - export function xxh3_64(input: Buffer): BigInt␊ + export function xxh3_64(input: Buffer): bigint␊ /** xxh128 function */␊ - export function xxh128(input: Buffer): BigInt␊ + export function xxh128(input: Buffer): bigint␊ /** Xxh3 class */␊ export class Xxh3 {␊ constructor()␊ /** update */␊ update(input: Buffer): void␊ - digest(): BigInt␊ + digest(): bigint␊ }␊ }␊ export namespace xxh2 {␊ export function xxh2Plus(a: number, b: number): number␊ - export function xxh3Xxh64Alias(input: Buffer): BigInt␊ + export function xxh3Xxh64Alias(input: Buffer): bigint␊ }␊ ` diff --git a/examples/napi/__test__/typegen.spec.ts.snap b/examples/napi/__test__/typegen.spec.ts.snap index a929b2b0..a29f5f01 100644 Binary files a/examples/napi/__test__/typegen.spec.ts.snap and b/examples/napi/__test__/typegen.spec.ts.snap differ diff --git a/examples/napi/index.d.ts b/examples/napi/index.d.ts index 31d68233..d6e712b8 100644 --- a/examples/napi/index.d.ts +++ b/examples/napi/index.d.ts @@ -17,9 +17,9 @@ export function getNums(): Array export function sumNums(nums: Array): number export function readFileAsync(path: string): Promise export function asyncMultiTwo(arg: number): Promise -export function bigintAdd(a: BigInt, b: BigInt): BigInt -export function createBigInt(): BigInt -export function createBigIntI64(): BigInt +export function bigintAdd(a: bigint, b: bigint): bigint +export function createBigInt(): bigint +export function createBigIntI64(): bigint export function getCwd(callback: (arg0: string) => void): void /** napi = { version = 2, features = ["serde-json"] } */ export function readFile(callback: (arg0: Error | undefined, arg1?: string | undefined | null) => void): void @@ -59,7 +59,7 @@ export function createExternalString(content: string): ExternalObject export function getExternal(external: ExternalObject): number export function mutateExternal(external: ExternalObject, newVal: number): void export function tsRename(a: { foo: number }): string[] -export function xxh64Alias(input: Buffer): BigInt +export function xxh64Alias(input: Buffer): bigint export function getMapping(): Record export function sumMapping(nums: Record): number export function mapOption(val?: number | undefined | null): number | undefined | null @@ -197,18 +197,18 @@ export class JsClassForEither { } export namespace xxh3 { export const ALIGNMENT: number - export function xxh3_64(input: Buffer): BigInt + export function xxh3_64(input: Buffer): bigint /** xxh128 function */ - export function xxh128(input: Buffer): BigInt + export function xxh128(input: Buffer): bigint /** Xxh3 class */ export class Xxh3 { constructor() /** update */ update(input: Buffer): void - digest(): BigInt + digest(): bigint } } export namespace xxh2 { export function xxh2Plus(a: number, b: number): number - export function xxh3Xxh64Alias(input: Buffer): BigInt + export function xxh3Xxh64Alias(input: Buffer): bigint } diff --git a/tsconfig.json b/tsconfig.json index 5de32776..16988746 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -27,5 +27,5 @@ "lib": ["dom", "DOM.Iterable", "ES2019", "ES2020", "esnext"] }, "include": ["."], - "exclude": ["node_modules", "bench", "cli/scripts", "scripts", "examples"] + "exclude": ["node_modules", "bench", "cli/scripts", "scripts"] }