PageSourceSearch

https://hoist-learn.netlify.app/chunk-DXX5itlX.js

js hoist-learn.netlify.app collected 2026-10-03 10:55:11 UTC 2,985 bytes, 3 lines download raw bytes

1var e=[{id:`strip-what-fails`,lessonId:`type-stripping`,prompt:`Name the TypeScript constructs Node cannot run, and the one rule that predicts all of them.`,answer:"`enum`, `const enum`, namespaces containing values, parameter properties, and angle-bracket assertions. The rule: if `tsc` would emit JavaScript for it, stripping cannot handle it.",why:`Stripping replaces type syntax with whitespace, so there is nowhere for generated code to go. One rule beats memorising a list.`},{id:`strip-does-not-check`,lessonId:`type-stripping`,prompt:"Does `node app.ts` fail on a type error?",answer:"No. It never reads the types — it erases them. You still need `tsc --noEmit` in CI and your editor.",why:`This is the single most common misconception about the feature, and acting on it is how a codebase quietly stops being type-checked.`},{id:`strip-param-property`,lessonId:`type-stripping`,prompt:`What happens here, and why?`,lang:`ts`,code:`class P { constructor(private n: number) {} }
2new P(5);`,answer:'ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX: "TypeScript parameter property is not supported in strip-only mode". It would require generating `this.n = n` in the constructor body.',why:`Parameter properties look like pure annotation but are the clearest case of type syntax that emits code, which makes them the best example of the boundary.`},{id:`strip-whitespace-trick`,lessonId:`type-stripping`,prompt:`Why does Node overwrite type syntax with spaces instead of deleting it?`,answer:`So every remaining token keeps its original line and column, which makes stack traces correct without generating source maps.`,why:`It explains why the feature could ship in core at all — no source-map machinery, and no build artifacts to manage.`},{id:`strip-enum-replacement`,lessonId:`type-stripping`,prompt:'Write the erasable replacement for `enum Color { Red = "red", Green = "green" }`.',lang:`ts`,code:`const Color = { Red: 'red', Green: 'green' } as const;
3// and the type?`,answer:'`type Color = (typeof Color)[keyof typeof Color];` — giving the union `"red" | "green"`.',why:`It is plain JavaScript, it tree-shakes, and it avoids enum reverse mappings. The erasability constraint pushed people toward the better pattern anyway.`},{id:`strip-erasable-flag`,lessonId:`type-stripping`,prompt:"What does `erasableSyntaxOnly` do, and which error code does it report?",answer:`It makes tsc reject any construct that is not pure type syntax, reporting TS1294 — so you see the problem in the editor rather than at runtime.`,why:`It is the check-time half of the runtime feature, and it is equally the right setting for any esbuild or SWC pipeline.`},{id:`strip-dependencies`,lessonId:`type-stripping`,prompt:`Does type stripping apply to your dependencies?`,answer:`No — only to your own files. Packages in node_modules still ship JavaScript plus .d.ts files.`,why:`It bounds the feature usefully: stripping changes your dev loop, not the publishing story for libraries.`}];export{e as t};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.