@putout/plugin-apply-as-type-assertions

putout plugin adds ability to apply as type assertion

Usage no npm install needed!

<script type="module">
  import putoutPluginApplyAsTypeAssertions from 'https://cdn.skypack.dev/@putout/plugin-apply-as-type-assertions';
</script>

README

@putout/plugin-apply-as-type-assertions NPM version

🐊Putout plugin adds ability to apply as type assertion according to best practices. Moved to @putout/plugin-typescript.

Install

npm i @putout/plugin-apply-as-type-assertions

Rule

Rule apply-as-type-assertions is not bundled by default, to enable add to .putout.json:

Rule

{
    "rules": {
        "apply-as-type-assertions": "on"
    }
}

❌ Incorrect code example

const boundaryElement = <HTMLElement>e.target;

✅ Correct code Example

const boundaryElement1 = e.target as HTMLElement;

License

MIT