Loading topic
tsconfig.json, and a clear idea of what each option does and why it is set the way it is.5 min readtsconfig.json from the previous chapter, and a working knowledge of modern JavaScript. You do not need to know TypeScript syntax yet. The chapter covers how to let .js and .ts files live in one project, and how to get type feed5 min readtsconfig.json with allowJs: true (as in the earlier setup chapters), typescript and @types/node installed, and5 min readtsconfig.json like the one from the setup chapter (allowJs on, strict off) and have just renamed one .js file to .ts. You should be able to run npx tsc in a terminal and know basic JavaScript. Annotations and interfaces come in the next chapters. H4 min read.ts, most errors trace back to functions whose parameters have no types. This chapter covers how to annotate parameters and return values. It also covers when to leave a type for the compiler to infer.5 min readtsconfig.json, have renamed at least one .js file to .ts, and can read basic compiler errors. After renaming, the compiler usually reports errors like Property 'name' does not exist on type '{}' or Parameter 'user' implicitly has an 'any' type. Most 5 min readtsconfig.json, have renamed at least one .js file to .ts, and can read basic compiler errors. It covers where implicit any comes from, how to turn on noImplicitAny without strict mode, and how to remove each kind of implicit any with a real type.6 min readimport and export statements when a file moves from JavaScript to TypeScript. It assumes you have a working tsconfig.json from the setup chapter, know the difference between CommonJS (require) and ES modules (import), and have already renamed a file to `5 min readtsconfig.json and have renamed at least one file to .ts. You should also know how import resolves packages from node_modules and what noImplicitAny does. After the rename, the compiler starts asking what types your dependencies have. This chapter sho5 min readtsconfig.json, at least one file renamed to .ts, and a basic grasp of annotations and interfaces from earlier chapters. You should also know that JavaScript has two "no value" values: null and undefined.5 min read.ts, added parameter and return annotations, and turned on strictNullChecks. If string | undefined or User | null still looks unfamiliar, review the chapter on handling null and undefined first.4 min read.ts, you can read basic compiler errors, and you know how to write interfaces and type annotations. When you convert a file, any is the quickest way to make an error disappear. It is also the way to lose the benefit of the conversion. This chapter 5 min readtsconfig.json with allowJs, rootDir: "src" and outDir: "dist" (set up in earlier chapters). It also assumes you have renamed at least one file to .ts and fixed its compiler errors. Here you will compile the project, run the output, and handle the problems th5 min read.ts, you can read basic compiler errors, and you know what any, unknown, narrowing and null checks are from earlier chapters. Here you will switch on strict checking in stages. The goal is to avoid one change that produces th5 min readtsc runs cleanly on it, and that you can read basic npm scripts. It also assumes you have used Git and a hosted CI service. Here you will add checks that stop the converted code from drifting back to untyped habits.5 min read