Modify rule S4125: remove types from code examples and add BigInt (#1044)

This commit is contained in:
Ilia Kebets 2022-06-13 15:43:02 +02:00 committed by GitHub
parent ff35e55506
commit a30f04f139
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,7 @@ The ``++typeof++`` operator returns a string indicating the type of its argument
* "symbol" (since ECMAScript 2015)
* "function"
* "object" (for ``++null++`` and any other object)
* "BigInt" (since ECMAScript 2020)
Compare a ``++typeof++`` expression to anything else, and the result is predefined: ``++false++``.
@ -15,7 +16,7 @@ Compare a ``++typeof++`` expression to anything else, and the result is predefin
[source,javascript]
----
function someFunc(x: any): boolean {
function someFunc(x) {
return typeof x === "Number"; // Noncompliant, function will always return 'false'
}
----
@ -25,7 +26,7 @@ function someFunc(x: any): boolean {
[source,javascript]
----
function someFunc(x: any): boolean {
function someFunc(x) {
return typeof x === "number";
}
----