Skip to content

Design Meeting Notes, 9/9/2025 #62583

@DanielRosenwasser

Description

@DanielRosenwasser

noUncheckedSideEffectImports by default

#62421

  • [[Funny aside - presenter wrote import whoops from "whoops" as an example in the TypeScript playground expecting an error, but gets none because a package named whoops actually exists on npm and we fetched its types.]]
  • You can write import * as blah from "./something-that-doesnt-exist-i-swear.css, you will get an error.
  • But if you write import "./something-that-doesnt-exist-i-swear.css, you will get no error.
  • We added --noUncheckedSideEffectImports to catch this, but its default is false.
  • For users who want it on but for certain things to work (e.g. importing .css files), they either need
    • declare module "*.css" at the top level of (a non-module) .d.ts file.
    • write a .d.css.ts file per CSS file.
  • Users can also always // @ts-ignore.
  • If we want it for 6.0, do this immediately on 7.0.
  • The reason we didn't add the error initially was because we didn't have pattern ambient modules like *.filetype.
  • Would like to special-case the error message.
  • Pattern ambient modules are the least safe way to declare this, which is unfortunate. Sort of defeats the purpose.

Enable --allowImportingTsExtensions by default

#62342

  • Most server-side runtimes + bundlers support .ts imports.
  • Want people to just be able to run .ts files with no extra flag/
  • --allowImportingTsExtensions is off by default.
    • Requires --noEmit though.
  • There's also --rewriteRelativeImportExtensions which is off by default, but wouldn't you actually want this more?
  • So much of this really needs to be informed by whether you have --noEmit.
  • We don't want to make this behavior dependent on more flags.
  • Maybe a good first step is to turn allowImportingTsExtensions on in the default editor config.
  • rewriteRelativeImportExtensions being on depending on outDir seems tempting.
    • "no it isn't!"
  • A lot of this is really dependent on the target system.
  • This kind of relies on if you're an app author or library author?
    • App authors don't care, will likely always run directly from source.
    • Library authors care because they must emit; they can't ship .ts files.
      • But can't make rewriteRelativeImportExtensions on by default because no default outDir.
      • Wait, that's not a problem. That's why allowJs must be off by default.
  • esnext is a weird target for this.
    • nodenext?
    • bundler?
    • Makes sense under these.
  • We should be able to make things "just work" to run .ts files in an editor.
    • Sure, but what happens as soon as you add a tsconfig.json?
  • We can fix this in the editor - what about type-checking?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Design NotesNotes from our design meetings

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions