Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit c67d22a

Browse files
mprobstKeen Yee Liau
authored and
Keen Yee Liau
committed
Turn back on TypeScript error truncation.
TypeScript runs out of memory trying to produce a human readable diagnostic in certain situations (infinitely recursing through anonymous type), see microsoft/TypeScript#37230. That's a bug, but more generally speaking, the default TypeScript behaviour is to run with error truncation. That's for a reason: some errors are much more readable with truncation. TypeScript's core team made the call that error truncation is generally a good idea, so we should follow along unless we have strong data indication otherwise (which we don't). Beyond that, error truncation being the default means it is the better tested path, so we'll probably save us some trouble in the future by keeping it enabled. PiperOrigin-RevId: 299096788
1 parent 06338d1 commit c67d22a

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

internal/common/tsconfig.bzl

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,17 @@ def create_tsconfig(
253253
# Interpret JSX as React calls (until someone asks for something different)
254254
"jsx": "react",
255255

256-
# Print out full errors. By default TS truncates errors >100 chars. This can make it
257-
# impossible to understand some errors.
258-
"noErrorTruncation": True,
259-
# Do not emit files if they had errors (avoid accidentally serving broken code).
256+
# Truncate excessively long errors.
257+
# While truncation can make some errors harder to understand, it makes
258+
# others easier to read. Additionally, for certain errors, TypeScript
259+
# can run out of memory trying to convert them into a humand readable
260+
# string (see https://github.com/Microsoft/TypeScript/issues/37230).
261+
# That's a bug, but the general default configuration of TypeScript is
262+
# to truncate, so following that seems safer and more in line with the
263+
# expected developer UX.
264+
"noErrorTruncation": False,
265+
# Do not emit files if they had errors (avoid accidentally serving
266+
# broken code).
260267
"noEmitOnError": False,
261268
# Create .d.ts files as part of compilation.
262269
"declaration": True,

0 commit comments

Comments
 (0)