WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

🐛 Bug: strictNonNullAssertions does not understand that undefined is accepted in union array #1518

@rubiesonthesky

Description

@rubiesonthesky

Bug Report Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have pulled the latest main branch of the repository.
  • I have searched for related issues and found none that matched my issue.

Expected

I expected it to not add ! to undefined

const someArray: (string | undefined)[] = [];
someArray.push(undefined);

Actual

const someArray: (string | undefined)[] = [];
someArray.push(undefined!);

Additional Info

typestat.json

[
    {
        "fixes": {
            "strictNonNullAssertions": true
        },
        "include": [
            "src/**/*.{ts,tsx}"
        ],
        "projectPath": "./tsconfig.json",
        "types": {
            "strictNullChecks": true
        }
    }
]

tsconfig

{
	"compilerOptions": {
		"declaration": true,
		"declarationMap": true,
		"esModuleInterop": true,
		"module": "NodeNext",
		"moduleResolution": "NodeNext",
		"noEmit": true,
		"outDir": "lib",
		"resolveJsonModule": true,
		"skipLibCheck": true,
		"sourceMap": true,
		"strict": true,
		"target": "ES2022"
	},
	"include": ["src", "test/*.ts"]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: accepting prsPlease, send a pull request to resolve this! 🙏type: bugSomething isn't working :( 🐛

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions