Skip to content

Commit 7e0ac00

Browse files
fix: crash
1 parent 17df480 commit 7e0ac00

File tree

1 file changed

+19
-26
lines changed

1 file changed

+19
-26
lines changed

generate-types/index.js

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,25 @@ const printError = (diagnostic) => {
725725

726726
const { typeMapping } = options;
727727

728+
const isArrayBufferLike = (name) => {
729+
return [
730+
"Uint8Array",
731+
"Uint8ClampedArray",
732+
"Uint16Array",
733+
"Uint32Array",
734+
"Int8Array",
735+
"Int16Array",
736+
"Int32Array",
737+
"BigUint64Array",
738+
"BigInt64Array",
739+
"Float16Array",
740+
"Float32Array",
741+
"Float64Array",
742+
"DataView",
743+
"Buffer",
744+
].includes(name);
745+
};
746+
728747
/**
729748
* @param {ts.Type} type type
730749
* @returns {ParsedType | undefined} parsed type
@@ -2123,32 +2142,6 @@ const printError = (diagnostic) => {
21232142
return items;
21242143
};
21252144

2126-
// TODO remove me when minimum supported typescript version will be 5.7
2127-
const isArrayBufferLike = (name) => {
2128-
if (
2129-
[
2130-
"Uint8Array",
2131-
"Uint8ClampedArray",
2132-
"Uint16Array",
2133-
"Uint32Array",
2134-
"Int8Array",
2135-
"Int16Array",
2136-
"Int32Array",
2137-
"BigUint64Array",
2138-
"BigInt64Array",
2139-
"Float16Array",
2140-
"Float32Array",
2141-
"Float64Array",
2142-
"DataView",
2143-
"Buffer",
2144-
].includes(name)
2145-
) {
2146-
return true;
2147-
}
2148-
2149-
return false;
2150-
};
2151-
21522145
/**
21532146
* @param {ts.Type} type the type
21542147
* @param {Set<ts.Type>} typeArgs type args specified in context

0 commit comments

Comments
 (0)