-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add refactoring to convert CommonJS module to ES6 module #19916
Changes from 6 commits
a4b588d
22c1f76
fe19adf
c02ddfc
051c9c8
4df53c1
d67ef00
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,11 +71,11 @@ namespace ts { | |
// Literals | ||
|
||
/** If a node is passed, creates a string literal whose source text is read from a source node during emit. */ | ||
export function createLiteral(value: string | StringLiteral | NumericLiteral | Identifier): StringLiteral; | ||
export function createLiteral(value: string | StringLiteral | NoSubstitutionTemplateLiteral | NumericLiteral | Identifier): StringLiteral; | ||
export function createLiteral(value: number): NumericLiteral; | ||
export function createLiteral(value: boolean): BooleanLiteral; | ||
export function createLiteral(value: string | number | boolean): PrimaryExpression; | ||
export function createLiteral(value: string | number | boolean | StringLiteral | NumericLiteral | Identifier): PrimaryExpression { | ||
export function createLiteral(value: string | number | boolean | StringLiteral | NoSubstitutionTemplateLiteral | NumericLiteral | Identifier): PrimaryExpression { | ||
if (typeof value === "number") { | ||
return createNumericLiteral(value + ""); | ||
} | ||
|
@@ -101,7 +101,7 @@ namespace ts { | |
return node; | ||
} | ||
|
||
function createLiteralFromNode(sourceNode: StringLiteral | NumericLiteral | Identifier): StringLiteral { | ||
function createLiteralFromNode(sourceNode: StringLiteralLike | NumericLiteral | Identifier): StringLiteral { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't internal, but it uses There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't exported so it won't show up in the public API. API baseline tests would have told us if we tried to use an internal type in a public api. |
||
const node = createStringLiteral(getTextOfIdentifierOrLiteral(sourceNode)); | ||
node.textSourceNode = sourceNode; | ||
return node; | ||
|
@@ -3626,7 +3626,7 @@ namespace ts { | |
return qualifiedName; | ||
} | ||
|
||
export function convertToFunctionBody(node: ConciseBody, multiLine?: boolean) { | ||
export function convertToFunctionBody(node: ConciseBody, multiLine?: boolean): Block { | ||
return isBlock(node) ? node : setTextRange(createBlock([setTextRange(createReturn(node), node)], multiLine), node); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can pass a function that only takes
x
, right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍