total-typescript / ts-reset

A 'CSS reset' for TypeScript, improving types for common JavaScript API's
https://www.totaltypescript.com/ts-reset
MIT License
7.74k stars 117 forks source link

Add typescript reference declaration to documentation #166

Open pc-erin opened 11 months ago

pc-erin commented 11 months ago

Something I had to figure out on my own after running into a similar problem to #150 is that you can import this so only typescript sees the changes by using a file like this:

env.d.ts

/// <reference types="@total-typescript/ts-reset" />

Maybe this should even be the default way of adding it, since we always want it's imports elided at runtime, but as far as I know, there's no way to declare a type-only side-effect import e.g. import type '@total-typescript/ts-reset'

This is also the only way I know of to make it play nice with verbatimModuleSyntax: true.

Anyway, was wondering if anyone wanted to add this method to the docs. I think it would helpful, especially for TS noobs.