napi-rs/examples/napi/index.d.ts
2021-10-27 14:42:57 +08:00

36 lines
1.5 KiB
TypeScript

export function getWords(): Array<string>
export function getNums(): Array<number>
export function sumNums(nums: Array<number>): number
export function readFileAsync(path: string): Promise<Array<number>>
export function getCwd(callback: (arg0: string) => void): void
export function readFile(callback: (arg0: Error | undefined, arg1: string | null) => void): void
export enum Kind { Dog = 0, Cat = 1, Duck = 2 }
export enum CustomNumEnum { One = 1, Two = 2, Three = 3, Four = 4, Six = 6, Eight = 8, Nine = 9, Ten = 10 }
export function enumToI32(e: CustomNumEnum): number
export function throwError(): void
export function mapOption(val: number | null): number | null
export function add(a: number, b: number): number
export function fibonacci(n: number): number
export function listObjKeys(obj: object): Array<string>
export function createObj(): object
interface PackageJson {
name: string
version: string
dependencies: Record<string, any> | null
devDependencies: Record<string, any> | null
}
export function readPackageJson(): PackageJson
export function getPackageJsonName(packageJson: PackageJson): string
export function contains(source: string, target: string): boolean
export function concatStr(mutS: string): string
export function concatUtf16(s: string): string
export function concatLatin1(s: string): string
export function getBuffer(): Buffer
export class Animal {
readonly kind: Kind
constructor(kind: Kind, name: string)
get name(): string
set name(name: string)
whoami(): string
static getDogKind(): Kind
}