Skip to content

Commit 7eba712

Browse files
authored
🤖 Merge PR DefinitelyTyped#73836 feat(emscripten) : Update createDevice API by @R3gardless
1 parent e8d2588 commit 7eba712

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

‎types/emscripten/emscripten-tests.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ function FSTest(): void {
104104
const bothDevice = FS.createDevice("/", "console", () => 66, (c: number) => console.log(c)); // Returns 'B' (66)
105105
const simpleDevice = FS.createDevice("/", "null");
106106

107+
// Test createDevice.major property access
108+
const majorNumber: number = FS.createDevice.major;
109+
FS.createDevice.major = 128; // Test assignment
110+
// $ExpectType number
111+
FS.createDevice.major;
112+
107113
FS.writeFile("file", "foobar");
108114
FS.symlink("file", "link");
109115

‎types/emscripten/index.d.ts‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,16 @@ declare namespace FS {
268268
function makedev(ma: number, mi: number): number;
269269
function registerDevice(dev: number, ops: Partial<StreamOps>): void;
270270
function getDevice(dev: number): { stream_ops: StreamOps };
271-
function createDevice(
272-
parent: string | FSNode,
273-
name: string,
274-
input?: () => number | null | undefined,
275-
output?: (c: number) => any,
276-
): FSNode;
271+
var createDevice:
272+
& ((
273+
parent: string | FSNode,
274+
name: string,
275+
input?: (() => number | null | undefined) | null,
276+
output?: ((code: number) => void) | null,
277+
) => FSNode)
278+
& {
279+
major: number;
280+
};
277281

278282
//
279283
// core

0 commit comments

Comments
 (0)