fix(napi-derive): BigInt in TypeScript should be bigint
This commit is contained in:
parent
5ef1d11e27
commit
b53e0e1e95
6 changed files with 26 additions and 26 deletions
|
@ -115,14 +115,14 @@ static KNOWN_TYPES: Lazy<HashMap<&'static str, &'static str>> = 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"),
|
||||
|
|
|
@ -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!)
|
||||
})
|
||||
|
|
|
@ -27,9 +27,9 @@ Generated by [AVA](https://avajs.dev).
|
|||
export function sumNums(nums: Array<number>): number␊
|
||||
export function readFileAsync(path: string): Promise<Buffer>␊
|
||||
export function asyncMultiTwo(arg: number): Promise<number>␊
|
||||
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>): number␊
|
||||
export function mutateExternal(external: ExternalObject<number>, 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<string, number>␊
|
||||
export function sumMapping(nums: Record<string, number>): 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␊
|
||||
}␊
|
||||
`
|
||||
|
|
Binary file not shown.
16
examples/napi/index.d.ts
vendored
16
examples/napi/index.d.ts
vendored
|
@ -17,9 +17,9 @@ export function getNums(): Array<number>
|
|||
export function sumNums(nums: Array<number>): number
|
||||
export function readFileAsync(path: string): Promise<Buffer>
|
||||
export function asyncMultiTwo(arg: number): Promise<number>
|
||||
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<string>
|
|||
export function getExternal(external: ExternalObject<number>): number
|
||||
export function mutateExternal(external: ExternalObject<number>, 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<string, number>
|
||||
export function sumMapping(nums: Record<string, number>): 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
|
||||
}
|
||||
|
|
|
@ -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"]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue