Loading topic
tsc feels slow, the first useful question is which part of the run is slow. The compiler does several different jobs in order, and each job slows down for different reasons. Reading a trace or rewriting a type before you know which job dominates wastes effort. This chapter gives you the worki8 min readtsc from a project directory, that your project has a tsconfig.json, and that you know that tsc parses, checks and emits files. Every later chapter compares its res6 min readtsconfig.json, run tsc from the command line, and use npx. It also assumes you have a baseline from --extendedDiagnostics, which the previous chapter covered. Here you will find out whether the compiler is checking more files than you intended, and why.7 min readtsc run and on measuring a baseline with --extendedDiagnostics. You should be comfortable editing tsconfig.json and reading the numbers tsc prints. Here you will learn what skipLibCheck skips, what it leaves alone, 7 min read--incremental lets tsc skip type checking for files that have not been affected by a change. It also covers what the .tsbuildinfo file stores, how to measure the gain, and the cases where the cache is thrown away.7 min readtsconfig.json, run tsc from the command line, and have already measured a baseline with --extendedDiagnostics. It also assumes that earlier steps (narrowing include, skipLibCheck, incremental) have not brought checking time down far enough.7 min readtsc --extendedDiagnostics and know which phase (parse, bind, check, emit) dominates your build. It also assumes you can read a tsconfig.json, and that you know what --listFilesOnly and --explainFiles tell you about program scope. If the check phase is the sl6 min read--generateTrace, as covered in the previous chapter. It also assumes you can read a tsconfig.json and run commands with npx. Here you will turn the raw trace into a short list of places to look at.7 min read--extendedDiagnostics and on generating and analyzing a trace. You should be comfortable with generics, conditional types, mapped types, and union types. The goal is to look at a type and judge, before you measure, whether the checker will6 min read--generateTrace result and a @typescript/analyze-trace report, which earlier chapters covered. You should also be comfortable with interfaces, generics, conditional types, and tsconfig.json. Here you will turn a hot spot that the trace found into a c7 min readtsc run, --extendedDiagnostics, and program scope. You should be able to open VS Code (or another editor that uses tsserver) and edit a tsconfig.json. The examples use VS Code settings, but the log format comes from `7 min readtsc from the command line, read a tsconfig.json, and have already made at least one change from earlier chapters: trimming the program, enabling incremental, splitting with project references, or rewriting a type. Here you confirm that the change worked and put7 min read