microsoft / microsoft/TypeScript

No error using imports/exports with --module=none and --target=es2015+

Open
#39,603 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Breaking Change Bug Domain: ES Modules Rescheduled
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

TypeScript Version: 4.0.0-dev.20200713

Search Terms: module none target

Code

// @module: none
// @target: es2015
export class Foo {}

Expected behavior:

TS1148 Cannot use imports, exports, or module augmentations when '--module' is 'none' and emits export class Foo {}

Actual behavior:

No error, and emits as CommonJS.

Playground Link: https://www.typescriptlang.org/play/?module=0#code/KYDwDg9gTgLgBAYwDYEMDOa4DEITgbwF8AoIA

Related issues: #39597

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the example from the issue or its Playground link with --module=none and --target=es2015. Trace the compiler's module and target handling, then verify that the case reports TS1148 and does not emit CommonJS output.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.