Merge pull request #1015 from napi-rs/fix/bigint
fix(napi-derive): BigInt in TypeScript should be bigint
This commit is contained in:
commit
8aee7928b9
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"),
|
("u8", "number"),
|
||||||
("u16", "number"),
|
("u16", "number"),
|
||||||
("u32", "number"),
|
("u32", "number"),
|
||||||
("u64", "BigInt"),
|
("u64", "bigint"),
|
||||||
("i64n", "BigInt"),
|
("i64n", "bigint"),
|
||||||
("u128", "BigInt"),
|
("u128", "bigint"),
|
||||||
("i128", "BigInt"),
|
("i128", "bigint"),
|
||||||
("usize", "BigInt"),
|
("usize", "bigint"),
|
||||||
("isize", "BigInt"),
|
("isize", "bigint"),
|
||||||
("JsBigInt", "BigInt"),
|
("JsBigInt", "bigint"),
|
||||||
("BigInt", "BigInt"),
|
("BigInt", "bigint"),
|
||||||
("JsBoolean", "boolean"),
|
("JsBoolean", "boolean"),
|
||||||
("bool", "boolean"),
|
("bool", "boolean"),
|
||||||
("JsString", "string"),
|
("JsString", "string"),
|
||||||
|
|
|
@ -5,5 +5,5 @@ const bindings = require('../index.node')
|
||||||
test('should get napi version', (t) => {
|
test('should get napi version', (t) => {
|
||||||
const napiVersion = bindings.getNapiVersion()
|
const napiVersion = bindings.getNapiVersion()
|
||||||
t.true(typeof napiVersion === 'number')
|
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 sumNums(nums: Array<number>): number␊
|
||||||
export function readFileAsync(path: string): Promise<Buffer>␊
|
export function readFileAsync(path: string): Promise<Buffer>␊
|
||||||
export function asyncMultiTwo(arg: number): Promise<number>␊
|
export function asyncMultiTwo(arg: number): Promise<number>␊
|
||||||
export function bigintAdd(a: BigInt, b: BigInt): BigInt␊
|
export function bigintAdd(a: bigint, b: bigint): bigint␊
|
||||||
export function createBigInt(): BigInt␊
|
export function createBigInt(): bigint␊
|
||||||
export function createBigIntI64(): BigInt␊
|
export function createBigIntI64(): bigint␊
|
||||||
export function getCwd(callback: (arg0: string) => void): void␊
|
export function getCwd(callback: (arg0: string) => void): void␊
|
||||||
/** napi = { version = 2, features = ["serde-json"] } */␊
|
/** napi = { version = 2, features = ["serde-json"] } */␊
|
||||||
export function readFile(callback: (arg0: Error | undefined, arg1?: string | undefined | null) => void): void␊
|
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 getExternal(external: ExternalObject<number>): number␊
|
||||||
export function mutateExternal(external: ExternalObject<number>, newVal: number): void␊
|
export function mutateExternal(external: ExternalObject<number>, newVal: number): void␊
|
||||||
export function tsRename(a: { foo: number }): string[]␊
|
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 getMapping(): Record<string, number>␊
|
||||||
export function sumMapping(nums: Record<string, number>): number␊
|
export function sumMapping(nums: Record<string, number>): number␊
|
||||||
export function mapOption(val?: number | undefined | null): number | undefined | null␊
|
export function mapOption(val?: number | undefined | null): number | undefined | null␊
|
||||||
|
@ -207,19 +207,19 @@ Generated by [AVA](https://avajs.dev).
|
||||||
}␊
|
}␊
|
||||||
export namespace xxh3 {␊
|
export namespace xxh3 {␊
|
||||||
export const ALIGNMENT: number␊
|
export const ALIGNMENT: number␊
|
||||||
export function xxh3_64(input: Buffer): BigInt␊
|
export function xxh3_64(input: Buffer): bigint␊
|
||||||
/** xxh128 function */␊
|
/** xxh128 function */␊
|
||||||
export function xxh128(input: Buffer): BigInt␊
|
export function xxh128(input: Buffer): bigint␊
|
||||||
/** Xxh3 class */␊
|
/** Xxh3 class */␊
|
||||||
export class Xxh3 {␊
|
export class Xxh3 {␊
|
||||||
constructor()␊
|
constructor()␊
|
||||||
/** update */␊
|
/** update */␊
|
||||||
update(input: Buffer): void␊
|
update(input: Buffer): void␊
|
||||||
digest(): BigInt␊
|
digest(): bigint␊
|
||||||
}␊
|
}␊
|
||||||
}␊
|
}␊
|
||||||
export namespace xxh2 {␊
|
export namespace xxh2 {␊
|
||||||
export function xxh2Plus(a: number, b: number): number␊
|
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 sumNums(nums: Array<number>): number
|
||||||
export function readFileAsync(path: string): Promise<Buffer>
|
export function readFileAsync(path: string): Promise<Buffer>
|
||||||
export function asyncMultiTwo(arg: number): Promise<number>
|
export function asyncMultiTwo(arg: number): Promise<number>
|
||||||
export function bigintAdd(a: BigInt, b: BigInt): BigInt
|
export function bigintAdd(a: bigint, b: bigint): bigint
|
||||||
export function createBigInt(): BigInt
|
export function createBigInt(): bigint
|
||||||
export function createBigIntI64(): BigInt
|
export function createBigIntI64(): bigint
|
||||||
export function getCwd(callback: (arg0: string) => void): void
|
export function getCwd(callback: (arg0: string) => void): void
|
||||||
/** napi = { version = 2, features = ["serde-json"] } */
|
/** napi = { version = 2, features = ["serde-json"] } */
|
||||||
export function readFile(callback: (arg0: Error | undefined, arg1?: string | undefined | null) => void): void
|
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 getExternal(external: ExternalObject<number>): number
|
||||||
export function mutateExternal(external: ExternalObject<number>, newVal: number): void
|
export function mutateExternal(external: ExternalObject<number>, newVal: number): void
|
||||||
export function tsRename(a: { foo: number }): string[]
|
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 getMapping(): Record<string, number>
|
||||||
export function sumMapping(nums: Record<string, number>): number
|
export function sumMapping(nums: Record<string, number>): number
|
||||||
export function mapOption(val?: number | undefined | null): number | undefined | null
|
export function mapOption(val?: number | undefined | null): number | undefined | null
|
||||||
|
@ -197,18 +197,18 @@ export class JsClassForEither {
|
||||||
}
|
}
|
||||||
export namespace xxh3 {
|
export namespace xxh3 {
|
||||||
export const ALIGNMENT: number
|
export const ALIGNMENT: number
|
||||||
export function xxh3_64(input: Buffer): BigInt
|
export function xxh3_64(input: Buffer): bigint
|
||||||
/** xxh128 function */
|
/** xxh128 function */
|
||||||
export function xxh128(input: Buffer): BigInt
|
export function xxh128(input: Buffer): bigint
|
||||||
/** Xxh3 class */
|
/** Xxh3 class */
|
||||||
export class Xxh3 {
|
export class Xxh3 {
|
||||||
constructor()
|
constructor()
|
||||||
/** update */
|
/** update */
|
||||||
update(input: Buffer): void
|
update(input: Buffer): void
|
||||||
digest(): BigInt
|
digest(): bigint
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export namespace xxh2 {
|
export namespace xxh2 {
|
||||||
export function xxh2Plus(a: number, b: number): number
|
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"]
|
"lib": ["dom", "DOM.Iterable", "ES2019", "ES2020", "esnext"]
|
||||||
},
|
},
|
||||||
"include": ["."],
|
"include": ["."],
|
||||||
"exclude": ["node_modules", "bench", "cli/scripts", "scripts", "examples"]
|
"exclude": ["node_modules", "bench", "cli/scripts", "scripts"]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue