0.0.1 • Published 1 year ago

common-dts v0.0.1

Weekly downloads
-
License
WTFPL
Repository
github
Last release
1 year ago

 

 

common-dts

Collection of reusable .d.ts files commonly used on your projects. So you don't need to Google it again.

hr

Installation

NPM
npm i -D common-dts
PNPM
pnpm add -D common-dts
PNPM
yarn add -D common-dts

hr

Usage

A. Globally

The entire project will affected when using this method. So, you don't need to importing the type again.

Don't want to affect the entire project? Use Locally method for individual file configuration.

Format

Put this code on any .d.ts file on your project. Or you can create a new one if it doesn't exist.

declare global {
  import "common-dts/types/<file-name>";
}

See Supported Extensions for the list of available <file-name>.

Example
declare global {
  import "common-dts/types/module.css";
  import "common-dts/types/module.scss";
  import "common-dts/types/react/svg";
}

B. Locally

Only file with the imported type will affected when using this method.

Format
import "common-dts/types/<file-name>";

See Supported Extensions for the list of available <file-name>.

Example
import "common-dts/types/module.scss";

// Now you can import your SCSS file without typing error
import classes from "./index.module.scss";

// Your code

hr

Supported Extensions

FrameworkNameExtensionFile Name
AnyCSS Module.module.cssmodule.css.d.ts
AnySass or SCSS Module.module.scss .module.sassmodule.scss.d.ts
AnyAVIF.avifavif.d.ts
AnyBitmap.bmpbmp.d.ts
AnyPNG.pngpng.d.ts
AnyJPG.jpg .jpegjpg.d.ts
AnyGIF.gifgif.d.ts
AnyWEBP.webpwebp.d.ts
ReactSVG.svgreact/svg.d.ts
Vue 2SVG.svgvue2/svg.d.ts
Vue 3SVG.svgvue3/svg.d.ts
SolidSVG.svgsolid/svg.d.ts
SvelteSVG.svgsvelte/svg.d.ts