Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-no-type-assertion

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-no-type-assertion - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

4

CHANGELOG.md
# Changelog
## 1.2.0 - 2022-03-26
- Ban non-null assertion operator
## 1.1.1 - 2021-11-28

@@ -4,0 +8,0 @@

@@ -10,2 +10,3 @@ module.exports = {

asAssertion: "Do not use as operator for type assertion",
nonNullAssertion: "Do not use non-null assertion operator",
},

@@ -39,4 +40,8 @@ schema: [],

},
TSNonNullExpression(node) {
context.report({ node, messageId: "nonNullAssertion" });
},
};
},
};

2

package.json
{
"name": "eslint-plugin-no-type-assertion",
"version": "1.1.1",
"version": "1.2.0",
"description": "Disallow type assertions in TypeScript code",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -10,4 +10,8 @@ # eslint-plugin-no-type-assertion

const bar = <number>foo;
const baz = foo as number;
const notAString = <string>foo; // can't perform angle-bracketed type assertion
const alsoNotAString = foo as string; // can't use `as` operator for type assertion
const objectWithOptionalProperty: { a?: number } = {};
const notANumber = objectWithOptionalProperty.a! / 2; // can't use non-null assertion operator
```

@@ -14,0 +18,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc