Skip to content

Commit 7dad671

Browse files
committed
polyfill automaticlly Symbol.metadata (for bun)
1 parent c2e9a52 commit 7dad671

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

bun-preload.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
import "@sigma/deno-compat";
2-
//@ts-ignore polyfill
3-
Symbol.metadata ??= Symbol("Symbol.metadata");

src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import { tokenize } from "./tokenizer.ts";
1414
import { parseTokens } from "./parser.ts";
1515
import process from "node:process";
1616

17-
if (typeof Symbol === "undefined" || !Symbol.metadata) {
18-
throw new Error(
19-
"Symbol.metadata is not defined. This might mean the decorator implementation is incomplete or a polyfill is missing.",
20-
);
17+
// @ts-ignore polyfill
18+
if (typeof Symbol !== "undefined" && !Symbol.metadata) {
19+
// @ts-ignore polyfill
20+
Symbol.metadata = Symbol("Symbol.metadata");
2121
}
2222

2323
/**

0 commit comments

Comments
 (0)