Skip to content

tsc complaining about violating noUncheckedIndexedAccess in node_modules #48779

Closed
@hibaAkroush

Description

@hibaAkroush

Bug Report

after enabling noUncheckedIndexedAccess compilation rule I noticed TSC is complaining about the rule being violated inside node_modules/someLib/someFile.tsx.

what i have tried

1- skipLibCheck: which will only exclude .d.ts files

2- explicitly excluding node_modules which will not work because imported files are always part of the compilation!

due to:

You're most likely including the source file in your project. `exclude` only acts as a filter on top of `include`, but imported files are always part of the compilation. You can use the [--explainFiles](https://www.typescriptlang.org/tsconfig/#explainFiles) compiler option to figure out why the file was included in the compilation.

This might be relevant to you: #30511

Originally posted by @MartinJohns in #47387 (comment)

this basically means that if one wants to enable any type check ALL the libraries used by me have to have the same level of strictness and have to enable the same type checks which makes no sense for something optional like noUncheckedIndexedAccess.

is there a way to really exclude type checking for files inside node_modules?

Similar Issues

#47387
#46634

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions