From 027fb480da5cadf3251c8aba6a856e1c5945afe5 Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Wed, 4 Oct 2023 18:03:51 -0700 Subject: [PATCH] Fix TypedArray --- src/core/pyproxy.ts | 2 +- src/js/api.ts | 1 + src/js/ffi.ts | 2 +- src/js/lib.ts | 21 +++++++++++---------- src/js/pyodide.ts | 1 + 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/core/pyproxy.ts b/src/core/pyproxy.ts index 4a63e459ab3..7bbd6fb9988 100644 --- a/src/core/pyproxy.ts +++ b/src/core/pyproxy.ts @@ -18,7 +18,7 @@ declare var Tests: any; declare var Module: any; declare var Hiwire: any; -import "lib"; +import {TypedArray} from "lib"; import { warnOnce } from "pyodide_util"; // pyodide-skip diff --git a/src/js/api.ts b/src/js/api.ts index e099b717e7b..3804e0e4751 100644 --- a/src/js/api.ts +++ b/src/js/api.ts @@ -12,6 +12,7 @@ import { version } from "./version"; import "./error_handling.gen.js"; import { setStdin, setStdout, setStderr } from "./streams"; import { makeWarnOnce } from "./pyodide_util"; +import { TypedArray } from "./lib"; /** * Runs code after python vm has been initialized but prior to any bootstrapping. diff --git a/src/js/ffi.ts b/src/js/ffi.ts index e601783c3f9..ee538f6edc9 100644 --- a/src/js/ffi.ts +++ b/src/js/ffi.ts @@ -19,7 +19,7 @@ export type { PyMutableSequence, } from "./pyproxy.gen"; -export type { TypedArray }; +export type { TypedArray } from "./lib"; export type { PythonError } from "./error_handling.gen"; diff --git a/src/js/lib.ts b/src/js/lib.ts index 9941c3ed788..15f23f52692 100644 --- a/src/js/lib.ts +++ b/src/js/lib.ts @@ -5,19 +5,20 @@ import { type ConfigType } from "./pyodide"; import { type InFuncType } from "./streams"; import { type PackageData } from "./load-package"; +export type TypedArray = +| Int8Array +| Uint8Array +| Int16Array +| Uint16Array +| Int32Array +| Uint32Array +| Uint8ClampedArray +| Float32Array +| Float64Array; + declare global { export var Module: Module; export var API: API; - export type TypedArray = - | Int8Array - | Uint8Array - | Int16Array - | Uint16Array - | Int32Array - | Uint32Array - | Uint8ClampedArray - | Float32Array - | Float64Array; } // Emscripten runtime methods diff --git a/src/js/pyodide.ts b/src/js/pyodide.ts index ae20020bb93..9a162e43053 100644 --- a/src/js/pyodide.ts +++ b/src/js/pyodide.ts @@ -9,6 +9,7 @@ import { version } from "./version"; import type { PyodideInterface } from "./api.js"; import type { PyProxy, PyDict } from "./pyproxy.gen"; +import type { TypedArray } from "./lib"; export type { PyodideInterface, TypedArray }; export type {