mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Add bun-types to 'bun fmt' script
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
"build-fallback": "esbuild --target=esnext --bundle src/fallback.ts --format=iife --platform=browser --minify > src/fallback.out.js",
|
||||
"postinstall": "bash .scripts/postinstall.sh",
|
||||
"typecheck": "tsc --noEmit && cd test && bun run typecheck",
|
||||
"fmt": "prettier --write --cache './{src,test,bench,packages/{bun-inspector-*,bun-vscode,bun-debug-adapter-protocol}}/**/*.{mjs,ts,tsx,js,jsx}'",
|
||||
"fmt": "prettier --write --cache './{src,test,bench,packages/{bun-types,bun-inspector-*,bun-vscode,bun-debug-adapter-protocol}}/**/*.{mjs,ts,tsx,js,jsx}'",
|
||||
"lint": "eslint './**/*.d.ts' --cache",
|
||||
"lint:fix": "eslint './**/*.d.ts' --cache --fix"
|
||||
},
|
||||
|
||||
2
packages/bun-types/bun-test.d.ts
vendored
2
packages/bun-types/bun-test.d.ts
vendored
@@ -1034,7 +1034,7 @@ declare module "bun:test" {
|
||||
* expect("bar").not.toSatisfy((val) => val === "bun");
|
||||
* @link https://vitest.dev/api/expect.html#tosatisfy
|
||||
* @link https://jest-extended.jestcommunity.dev/docs/matchers/toSatisfy
|
||||
*/
|
||||
*/
|
||||
toSatisfy(predicate: (value: T) => boolean): void;
|
||||
/**
|
||||
* Asserts that a value starts with a `string`.
|
||||
|
||||
36
packages/bun-types/ffi.d.ts
vendored
36
packages/bun-types/ffi.d.ts
vendored
@@ -447,9 +447,7 @@ declare module "bun:ffi" {
|
||||
["callback"]: FFIType.pointer; // for now
|
||||
}
|
||||
|
||||
export type FFITypeOrString =
|
||||
| FFIType
|
||||
| keyof FFITypeStringToType;
|
||||
export type FFITypeOrString = FFIType | keyof FFITypeStringToType;
|
||||
|
||||
interface FFIFunction {
|
||||
/**
|
||||
@@ -549,7 +547,9 @@ declare module "bun:ffi" {
|
||||
// */
|
||||
// export function callback(ffi: FFIFunction, cb: Function): number;
|
||||
|
||||
export interface Library<Fns extends Readonly<Record<string, Narrow<FFIFunction>>>> {
|
||||
export interface Library<
|
||||
Fns extends Readonly<Record<string, Narrow<FFIFunction>>>,
|
||||
> {
|
||||
symbols: ConvertFns<Fns>;
|
||||
|
||||
/**
|
||||
@@ -584,7 +584,9 @@ declare module "bun:ffi" {
|
||||
[K in keyof Fns]: (
|
||||
...args: Fns[K]["args"] extends infer A extends readonly FFITypeOrString[]
|
||||
? { [L in keyof A]: FFITypeToArgsType[ToFFIType<A[L]>] }
|
||||
: [unknown] extends [Fns[K]["args"]] ? [] : never
|
||||
: [unknown] extends [Fns[K]["args"]]
|
||||
? []
|
||||
: never
|
||||
) => [unknown] extends [Fns[K]["returns"]]
|
||||
? void
|
||||
: FFITypeToReturnsType[ToFFIType<NonNullable<Fns[K]["returns"]>>];
|
||||
@@ -759,7 +761,7 @@ declare module "bun:ffi" {
|
||||
/**
|
||||
* The read function behaves similarly to DataView,
|
||||
* but it's usually faster because it doesn't need to create a DataView or ArrayBuffer.
|
||||
*
|
||||
*
|
||||
* @param ptr The memory address to read
|
||||
* @param byteOffset bytes to skip before reading
|
||||
*
|
||||
@@ -772,7 +774,7 @@ declare module "bun:ffi" {
|
||||
/**
|
||||
* The read function behaves similarly to DataView,
|
||||
* but it's usually faster because it doesn't need to create a DataView or ArrayBuffer.
|
||||
*
|
||||
*
|
||||
* @param ptr The memory address to read
|
||||
* @param byteOffset bytes to skip before reading
|
||||
*
|
||||
@@ -785,7 +787,7 @@ declare module "bun:ffi" {
|
||||
/**
|
||||
* The read function behaves similarly to DataView,
|
||||
* but it's usually faster because it doesn't need to create a DataView or ArrayBuffer.
|
||||
*
|
||||
*
|
||||
* @param ptr The memory address to read
|
||||
* @param byteOffset bytes to skip before reading
|
||||
*
|
||||
@@ -798,7 +800,7 @@ declare module "bun:ffi" {
|
||||
/**
|
||||
* The read function behaves similarly to DataView,
|
||||
* but it's usually faster because it doesn't need to create a DataView or ArrayBuffer.
|
||||
*
|
||||
*
|
||||
* @param ptr The memory address to read
|
||||
* @param byteOffset bytes to skip before reading
|
||||
*
|
||||
@@ -811,7 +813,7 @@ declare module "bun:ffi" {
|
||||
/**
|
||||
* The read function behaves similarly to DataView,
|
||||
* but it's usually faster because it doesn't need to create a DataView or ArrayBuffer.
|
||||
*
|
||||
*
|
||||
* @param ptr The memory address to read
|
||||
* @param byteOffset bytes to skip before reading
|
||||
*
|
||||
@@ -824,7 +826,7 @@ declare module "bun:ffi" {
|
||||
/**
|
||||
* The read function behaves similarly to DataView,
|
||||
* but it's usually faster because it doesn't need to create a DataView or ArrayBuffer.
|
||||
*
|
||||
*
|
||||
* @param ptr The memory address to read
|
||||
* @param byteOffset bytes to skip before reading
|
||||
*
|
||||
@@ -837,7 +839,7 @@ declare module "bun:ffi" {
|
||||
/**
|
||||
* The read function behaves similarly to DataView,
|
||||
* but it's usually faster because it doesn't need to create a DataView or ArrayBuffer.
|
||||
*
|
||||
*
|
||||
* @param ptr The memory address to read
|
||||
* @param byteOffset bytes to skip before reading
|
||||
*
|
||||
@@ -850,7 +852,7 @@ declare module "bun:ffi" {
|
||||
/**
|
||||
* The read function behaves similarly to DataView,
|
||||
* but it's usually faster because it doesn't need to create a DataView or ArrayBuffer.
|
||||
*
|
||||
*
|
||||
* @param ptr The memory address to read
|
||||
* @param byteOffset bytes to skip before reading
|
||||
*
|
||||
@@ -863,7 +865,7 @@ declare module "bun:ffi" {
|
||||
/**
|
||||
* The read function behaves similarly to DataView,
|
||||
* but it's usually faster because it doesn't need to create a DataView or ArrayBuffer.
|
||||
*
|
||||
*
|
||||
* @param ptr The memory address to read
|
||||
* @param byteOffset bytes to skip before reading
|
||||
*
|
||||
@@ -876,7 +878,7 @@ declare module "bun:ffi" {
|
||||
/**
|
||||
* The read function behaves similarly to DataView,
|
||||
* but it's usually faster because it doesn't need to create a DataView or ArrayBuffer.
|
||||
*
|
||||
*
|
||||
* @param ptr The memory address to read
|
||||
* @param byteOffset bytes to skip before reading
|
||||
*
|
||||
@@ -889,7 +891,7 @@ declare module "bun:ffi" {
|
||||
/**
|
||||
* The read function behaves similarly to DataView,
|
||||
* but it's usually faster because it doesn't need to create a DataView or ArrayBuffer.
|
||||
*
|
||||
*
|
||||
* @param ptr The memory address to read
|
||||
* @param byteOffset bytes to skip before reading
|
||||
*
|
||||
@@ -902,7 +904,7 @@ declare module "bun:ffi" {
|
||||
/**
|
||||
* The read function behaves similarly to DataView,
|
||||
* but it's usually faster because it doesn't need to create a DataView or ArrayBuffer.
|
||||
*
|
||||
*
|
||||
* @param ptr The memory address to read
|
||||
* @param byteOffset bytes to skip before reading
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user