TypeScript drops imports only used as types by default. verbatimModuleSyntax turns that off and keeps what you wrote, even imports of type-only packages.
Most of a production Strapi image is admin build tooling and frontend libraries the server never loads. Deploy only the app, drop webpack and delete the rest.
An overload set gives the branded argument a precise return type and the unbranded one a nullable type, so parsed callers skip dead checks.
Branding pays off for the Invalid Date hole, sanitization, money, ids and validated values. It is noise in one module or on mutable types.
TypeScript compares types by shape, so swapping a user id and a post id compiles. A brand makes them distinct and leaves nothing at runtime.
A CommonJS file resolves an ESM-only package through the require condition, so its types go missing. The resolution-mode attribute fixes it.
Migrate patch-package patches to pnpm patch in a few steps: the diff stays the same, only the paths inside the patch change.
Patch React so className accepts arrays and objects like Vue class bindings, without importing clsx in every app component.
JSX does not allow HTML comments. For learning purposes, here is how to trick React into rendering a real HTML comment node.
Sixteen ways to render something in Vue 3, from templates to render functions and JSX, with a full example repository to try.
Swap React for Preact in a Create React App project without ejecting, by installing preact/compat under the React names.
Should a function return a tuple or an object? Compare how each one minifies, and which is smaller in the production bundle.
JSX looks like HTML in JavaScript, but it compiles to React.createElement or jsx calls. A look at what JSX really turns into.
Next.js, Nuxt.js and Angular Universal need a server for redirects. On a static site, use HTML pages with a meta refresh.
A git alias that fetches with prune and deletes every local branch whose remote is gone, usually after a merged pull request.
Add custom search engines to the browser address bar, write bookmarklets, then combine both to run scripts from a query.
Context providers pile up into a deeply nested pyramid at the app root. Flatten them as a list with reduceRight in one line.
Private routes in React Router v5 wrapped Route and Redirect in a custom component. Here is the same guard with the v6 beta.
A git alias that removes a remote and adds it back with the same URL, dropping its stale remote branches in one command.
Set up Mock Service Worker in an Nx monorepo: install msw, generate the service worker file and add it to the app assets.
JSX creates new children elements on every render, so React.memo alone does not help. Memoize the children with useMemo too.
GitHub offers merge commit, squash and merge, and rebase and merge. When to use each, based on the pull request commits.
How I lay out the folders of an app and of a library, following the Angular style guide, with the tree output of each one.
React.lazy expects a module with a default export. Map a named export to default inside the dynamic import to lazy load it.
One implementation, several call signatures: how to write them for functions, methods, constructors and statics, and the rules that pick one.
A note proposed for the React docs: return early from render in a React.Component and a React.createRef ref may never attach.
The fetch Response type in lib.dom.d.ts returns any from json(). Extend it with a generic TypedResponse for typed payloads.
Stuck on a React version older than 16.2, with no fragments? A Fragment just returns its children, so you can write your own.
A QR code scanner types as a US keyboard, so other layouts get wrong text. Catch keypress and map each key back to EN-US.
How react-router v4 nests React context to override parent route info for children, and how to do it with the Context API.