Skip to content

Commit 00efed4

Browse files
committed
fix new ffi typings
1 parent 6d264b8 commit 00efed4

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

packages/quickjs-emscripten-core/src/context.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { JSPromiseStateEnum } from "@jitl/quickjs-ffi-types"
1+
import { IsEqualOp, JSPromiseStateEnum } from "@jitl/quickjs-ffi-types"
22
import type {
33
EvalFlags,
44
EitherModule,
@@ -44,7 +44,7 @@ import type {
4444
QuickJSHandle,
4545
StaticJSValue,
4646
} from "./types"
47-
import { IsEqualOp, evalOptionsToFlags, getOwnPropertyNamesOptionsToFlags } from "./types"
47+
import { evalOptionsToFlags, getOwnPropertyNamesOptionsToFlags } from "./types"
4848
import type {
4949
LowLevelJavascriptVm,
5050
SuccessOrFail,

packages/quickjs-emscripten-core/src/types.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,3 @@ export function concat<T>(...values: Array<T[] | T | undefined>): T[] {
329329
}
330330
return result
331331
}
332-
333-
export enum IsEqualOp {
334-
IsStrictlyEqual = 0,
335-
IsSameValue = 1,
336-
IsSameValueZero = 2,
337-
}

packages/quickjs-ffi-types/src/ffi-types.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ export type EvalDetectModule = Brand<number, "EvalDetectModule">
115115
*/
116116
export type GetOwnPropertyNamesFlags = Brand<number, "GetOwnPropertyNamesFlags">
117117

118+
/**
119+
* @private
120+
*/
121+
export type IsEqualOp = Brand<number, "IsEqualOp">
122+
118123
/**
119124
* State of a promise.
120125
*/
@@ -194,3 +199,9 @@ export const GetOwnPropertyNamesFlags = {
194199
/* set theJSPropertyEnum.is_enumerable field */
195200
JS_GPN_SET_ENUM: 1 << 5,
196201
}
202+
203+
export const IsEqualOp = {
204+
IsStrictlyEqual: 0 as IsEqualOp,
205+
IsSameValue: 1 as IsEqualOp,
206+
IsSameValueZero: 2 as IsEqualOp,
207+
}

scripts/generate.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ function cTypeToTypescriptType(ctype: string): ParsedType {
153153
return { ffi: "string", typescript: "string", ctype, attributes }
154154
}
155155

156+
if (type === "uint32_t*") {
157+
return { ffi: "number", typescript: "UInt32Pointer", ctype, attributes }
158+
}
159+
156160
if (type.startsWith("enum")) {
157161
return { ffi: "number", typescript: "number", ctype, attributes }
158162
}

0 commit comments

Comments
 (0)