From f35d31179483db4cc4706e305a13ccd8ca3247bb Mon Sep 17 00:00:00 2001 From: "Lyu, Wei-Da" <36730922+jasonlyu123@users.noreply.github.com> Date: Sun, 27 Aug 2023 15:49:05 +0800 Subject: [PATCH] (fix) manually define svelteSys.readFile for compatibility (#2142) --- packages/typescript-plugin/src/svelte-sys.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/typescript-plugin/src/svelte-sys.ts b/packages/typescript-plugin/src/svelte-sys.ts index e42a38117..ca0f60ede 100644 --- a/packages/typescript-plugin/src/svelte-sys.ts +++ b/packages/typescript-plugin/src/svelte-sys.ts @@ -17,6 +17,12 @@ export function createSvelteSys(ts: _ts, logger: Logger) { const extensionsWithSvelte = (extensions ?? []).concat('.svelte'); return ts.sys.readDirectory(path, extensionsWithSvelte, exclude, include, depth); + }, + readFile(path, encoding) { + // imba typescript plugin patch this with Object.defineProperty + // and copying the property descriptor from a class that extends the original ts.sys + // so we explicitly define it here + return ts.sys.readFile(path, encoding); } };