Skip to content

feat(strictest): add noUncheckedSideEffectImports option#276

Open
zanminkian wants to merge 1 commit into
tsconfig:mainfrom
zanminkian:noUncheckedSideEffectImports
Open

feat(strictest): add noUncheckedSideEffectImports option#276
zanminkian wants to merge 1 commit into
tsconfig:mainfrom
zanminkian:noUncheckedSideEffectImports

Conversation

@zanminkian

Copy link
Copy Markdown
Contributor

Closes #275.

This flag was introduced in TS 5.6

@orta

orta commented Oct 31, 2024

Copy link
Copy Markdown
Member

I don't think this should be in strictest, I think it's something that a lot of people use for .css files etc - its useful as a linter but not something I'd say should be in strictest

@zanminkian

Copy link
Copy Markdown
Contributor Author

If people import .css files, they usually add a shims.d.ts file in there project.

// shims.d.ts
declare module "*.css" {
  declare const css: unknown;
  export default css;
}

As for me, personally, I use triple slash directive at the beginning of the app entrance file.

// main.tsx
/// <reference types="vite/client" />
import "tailwindcss/tailwind.css";
import ReactDOM from "react-dom/client";
import { App } from "./App.jsx";

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
ReactDOM.createRoot(document.getElementById("root")!).render(<App />);

@jakebailey

Copy link
Copy Markdown
Collaborator

Yeah, this is what vite generates for you.

I'd really like to make this flag enabled by default in strict mode at some point.

@zanminkian

zanminkian commented Nov 26, 2024

Copy link
Copy Markdown
Contributor Author

Is it possible that we enable this flag when strict: true in TS 6.0? @jakebailey

@jakebailey

Copy link
Copy Markdown
Collaborator

I'll try to see if it can be enabled in 6.0 but I don't quite know for sure. It's a very breaky flag for many people.

@jakebailey

jakebailey commented Dec 18, 2024

Copy link
Copy Markdown
Collaborator

It's unlikely we're going to try and have it enabled by default for 6.0; but having it be recommended is another story (and maybe we'll make tsc --init suggest it).

@zanminkian

Copy link
Copy Markdown
Contributor Author

microsoft/TypeScript#62443 TypeScript enable this flag by default in 6.0. Do we need this PR now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

noUncheckedSideEffectImports needs to be added to strictest

3 participants