FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Ban import=require and export= under erasableSyntaxOnly by jakebailey · Pull Request #61175 · microsoft/TypeScript · GitHub

Ban import=require and export= under erasableSyntaxOnly - #61175

Merged
Jake Bailey (jakebailey) merged 2 commits into
microsoft:mainfrom
jakebailey:erasable-syntax-only-cjs
Feb 14, 2025
Merged

Jake Bailey (jakebailey) merged 2 commits into
microsoft:mainfrom
jakebailey:erasable-syntax-only-cjs

Conversation

Jake Bailey (jakebailey) commented Feb 14, 2025
edited
Loading

Copy link
Copy Markdown
Member

Per discussion; this syntax isn't supported by Node.js/Amaro or ts-blank-space, and export= is not actually erasable as its transformed syntax is module.exports=.

This effectively means you can't write any CJS code under erasableSyntaxOnly (without using const foo = require("foo") and module.exports = ... directly, which do not bind in TS). Perhaps we can make const foo = require("...") and module.exports = ... bind like they do in JS for TS files in the future.

Updates #59601
Updates #61011

return MyClassOk;
}());
//// [commonjs.cjs]
"use strict";

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Oh no, this means that CJS isn't even erasable because we assume strict and always insert it

Jake Bailey (jakebailey) merged commit 0f4737e into microsoft:main Feb 14, 2025

Copy link
Copy Markdown
Member Author

TypeScript Bot (@typescript-bot) cherry-pick this to release-5.8

TypeScript Bot (typescript-bot) commented Feb 14, 2025
edited
Loading

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
cherry-pick this to release-5.8 ✅ Started ✅ Results

Copy link
Copy Markdown
Contributor

Hey, Jake Bailey (@jakebailey)! I've created #61178 for you.

Copy link
Copy Markdown

Copy link
Copy Markdown
Member Author

No, definitely not. I forgot that default exports and export= are the same node.

Copy link
Copy Markdown
Member Author

Fix in #61210.

Copy link
Copy Markdown
Member Author

Merged, so should be fixed in the next nightly. I'm glad at least one person is testing them...

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL