Skip to content

add --outSuffix compiler option #32373

Description

@xialvjun

Search Terms

out, suffix

Suggestion

add --outSuffix compiler option

Use Cases

tsc --module es6 --outSuffix mjs

Examples

Imagine I have a package with file tree:
my_package/
├── a.ts
├── b.ts
├── index.ts
├── package.json
└── tsconfig.json

then I run:
> tsc --module es6 --outSuffix mjs
> tsc --module commonjs --outSuffix js

then the file tree will be:
my_package/
├── a.d.ts
├── a.js
├── a.mjs
├── a.ts
├── b.d.ts
├── b.js
├── b.mjs
├── b.ts
├── index.d.ts
├── index.js
├── index.mjs
├── index.ts
├── package.json
└── tsconfig.json

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

Activity

  1. xialvjun commented on Jul 12, 2019

    @xialvjun
    Author

    Oh, sorry, before I didn't search keyword mjs... Now I find these issues:
    #30076
    #18442

  2. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions