Simplify imports with path mapping →
Your TypeScript application uses relative imports. Every time you move a file, the imports break. You've configured path mapping, and now things break in an entirely new way.
Your TypeScript application uses relative imports. Every time you move a file, the imports break. You've configured path mapping, and now things break in an entirely new way.
Gatsby supports TypeScript out-the-box. Unfortunately, the official solution has several shortcomings which limit its usefulness. There is a better way.
Type guards let you provide TypeScript with more information about a variable's type. Type guards are especially useful when working with a variable which may be undefined
.
TypeScript's strict type checking can cause problems when working with numeric environment variables. Here's a solution.
By default, a Node.js stream expects to operate on a Buffer
or a Uint8Array
. We can override this by telling the stream to use "object mode".
Faker is a useful JavaScript library for generating dummy data. For example, faker.random.words(3)
generates a string containing three random words. But what if you want to generate an array of random words?
TypeScript doesn't always play nicely with object bracket notation.
The Node CLI supports a "require" flag, which allows you to preload a module when running Node.
Node isn't managed by npm
. As such, there's no guarantee that running npm install -D @types/node
will install the correct type definitions for your version of Node.
Use 'generics' when writing a TypeScript function which works with a variety of types.
A monthly round-up of blog posts, projects, and internet oddments.