Skip to content

⬅️ Back to Table of Contents

📄 no-inferrable-types.test.ts

📊 Analysis Summary

Metric Count
📦 Imports 5
📊 Variables & Constants 2
📑 Type Aliases 2

📚 Table of Contents

🛠️ File Location:

📂 packages/eslint-plugin/tests/rules/no-inferrable-types.test.ts

📦 Imports

Name Source
InvalidTestCase @typescript-eslint/rule-tester
RuleTester @typescript-eslint/rule-tester
InferMessageIdsTypeFromRule ../../src/util
InferOptionsTypeFromRule ../../src/util
rule ../../src/rules/no-inferrable-types

Variables & Constants

Name Type Kind Value Exported
testCases { code: string[]; type: string; }[] const `[
{
code: [
'10n',
'-10n',
'BigInt(10)',
'-BigInt(10)',
'BigInt?.(10)',
'-BigInt?.(10)',
],
type: 'bigint',
},
{
code: ['false', 'true', 'Boolean(null)', 'Boolean?.(null)', '!0'],
type: 'boolean',
},
{
code: [
'10',
'+10',
'-10',
'Number("1")',
'+Number("1")',
'-Number("1")',
'Number?.("1")',
'+Number?.("1")',
'-Number?.("1")',
'Infinity',
'+Infinity',
'-Infinity',
'NaN',
'+NaN',
'-NaN',
],
type: 'number',
},
{
code: ['null'],
type: 'null',
},
{
code: ['/a/', 'RegExp("a")', 'RegExp?.("a")', 'new RegExp("a")'],
type: 'RegExp',
},
{
code: ['"str"', "'str'", 'str', 'String(1)', 'String?.(1)'],
type: 'string',
},
{
code: ['Symbol("a")', 'Symbol?.("a")'],
type: 'symbol',
},
{
code: ['undefined', 'void someValue'],
type: 'undefined',
},
]`
ruleTester any const new RuleTester()

Type Aliases

MessageIds

type MessageIds = InferMessageIdsTypeFromRule<typeof rule>;

Options

type Options = InferOptionsTypeFromRule<typeof rule>;