X Tutup
Skip to content

Warnings with conditions other than boolean cannot be disabled #1341

@robincodex

Description

@robincodex
  • Added a warning when trying to use a type in a condition that can never be false in Lua, such as numbers or strings. (Only when strictNullChecks is enabled.)

I refer to the update log to set strictNullChecks to false, but it still triggers this warning.

const strictNullChecks = context.options.strict === true || context.options.strictNullChecks === true;

🤔Is it possible that || should be changed to &&

my tsconfig:

{
    "compilerOptions": {
        "rootDir": ".",
        "target": "esnext",
        "lib": ["esnext"],
        "moduleResolution": "node",
        "types": [
            "lua-types/jit",
            "@moddota/dota-lua-types",
            "typescript-to-lua/language-extensions"
        ],
        "strict": true,
        "strictNullChecks": false,
        "experimentalDecorators": true,
        "plugins": [
            {
                "transform": "@moddota/dota-lua-types/transformer"
            }
        ]
    },
    "include": ["**/*.ts"],
    "tstl": {
        "luaTarget": "JIT"
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup