Skip to content

Update typescript target level to improve stack traces #482

Closed
@phiresky

Description

@phiresky
diff --git a/tsconfig.json b/tsconfig.json
index d9c7f76..c127552 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -6,7 +6,7 @@
     "noImplicitAny": true,
     "lib": ["es2017", "es7", "es6", "dom"],
     "outDir": "./dist",
-    "target": "ES2015",
+    "target": "ES2020",
     "experimentalDecorators": true,
     "strictNullChecks": true,
     "moduleResolution": "Node",

before:

Not Found

  964 |         }
  965 |         catch (_b) {
> 966 |             throw new Error(response.statusText);
      |                   ^
  967 |         }
  968 |         if (!response.ok) {
  969 |             throw new Error((_a = json["error"]) !== null && _a !== void 0 ? _a : response.statusText);

  at LemmyHttp.<anonymous> (../../lemmy-js-client/dist/http.js:966:19)
      at Generator.throw (<anonymous>)
  at rejected (../../lemmy-js-client/dist/http.js:15:65)

after

Not Found

  938 |     }
  939 |     catch {
> 940 |         throw new Error(response.statusText);
      |               ^
  941 |     }
  942 |     if (!response.ok) {
  943 |         throw new Error(json["error"] ?? response.statusText);

  at LemmyHttp._LemmyHttp_wrapper (../../lemmy-js-client/dist/http.js:940:15)
  at Object.<anonymous> (src/tags.spec.ts:150:16)

note the actual source location src/tags.spec.ts:150:16 is present after but not before

if compat is important even es2017 as target should fix this

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions