TypeScript Libraries - Zero to One
We'll code together to create a new library from scratch, and incrementally add build tools, linting, testing and even automatic API documentation
tsconfig strictness
We'll look closely at the tsconfig we created for our library, examining a variety of the...
TypeScript Libraries - Zero to One
We'll code together to create a new library from scratch, and incrementally add build tools, linting, testing and even automatic API documentation
tsconfig strictness
We'll look closely at the tsconfig we created for our library, examining a variety of the compiler options we enabled
App vs Library Concerns
A discussion of different concerns to optimize for, depending on whether you're building a library or an app
Converting to TypeScript: Integrate TypeScript into your build, rename files to .ts, and incrementally enforce stricter types. Progressively refine type information, enhance function and class types, and reduce usage of any. Aim for methodical, incremental changes, backed by tests.
Steps 1, 2 and 3 - Adding our first types
We'll tackle steps 1, 2 and 3 in the TypeScript conversion process, by integrating TypeScript into our build tools, renaming our files to .ts, and getting rid of any implicit any types. We'll use this as an opportunity to learn how this kind of change can be made in many small PRs over a long period of time, as is common in large projects.
Declaration Files
TypeScript's .d.ts declaration files, overlay type info on JS files. DefinitelyTyped, a community-driven repository, hosts over 6,000 type declarations. Challenges arise with versioning, but tools like Yarn's TypeScript Plugin ease the process.
Step 4 - Dealing with Pure Type Information
We'll tackle step 4, and begin doing some domain modelling, and defining type information for things that are important to a slack app: user, team, channel and message
Step 5 - Null, undefined and boolean operators
We'll take on Step 5 to add safety to nullish value and boolean expression handling
Types At Runtime
We'll add some type guards to our project, and use them as the all-important "glue" joining compile-time type-checking and runtime behavior
Local Packages
We'll learn about yarn workspaces, and how they provide an opportunity for simple but effective modular architecture in a large TypeScript projects.
Tests for Types
We'll look closely at how we can write tests for type information, including negative test cases for things we want to ensure do not compile.
Size: 292.18 KB
Language: en
Added: Sep 14, 2024
Slides: 1 pages
Slide Content
CERTIFICATE OF COMPLETION
Check out my profile!
Ronny Freites
has successfully completed
Enterprise TypeScript
5 hours, 10 minutes
Mike North
Teacher
Frontend Masters Marc Grabanski
CEO Frontend Masters
Completed: Aug 13, 2024