UNPKG

@putout/plugin-remove-useless-types-from-constants

Version:

putout plugin adds ability to convert any to primitive type

42 lines (28 loc) • 1.01 kB
# @putout/plugin-remove-useless-types-from-constants [![NPM version][NPMIMGURL]][NPMURL] [NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-useless-types-from-constants.svg?style=flat&longCache=true [NPMURL]: https://npmjs.org/package/@putout/plugin-remove-useless-types-from-constants "npm" 🐊[`Putout`](https://github.com/coderaiser/putout) plugin adds ability to remove useless types from constants. Moved to [`@putout/plugin-typescript`](https://github.com/coderaiser/putout/tree/v24.0.2/packages/plugin-typescript#remove-useless-types-from-constants). ## Install ``` npm i @putout/plugin-remove-useless-types-from-constants -D ``` ## Rule Rule `remove-useless-types-from-constants` is enabled by default for `ts` and `tsx` files, to disable add to `.putout.json`: ```json { "rules": { "remove-useless-types-from-constants": "off" } } ``` ## āŒ Incorrect code example ```ts const x: any = 5; ``` ## āœ… Correct code Example ```ts const x = 5; ``` ## License MIT