Add printTypeScriptAccessibilityToken (#14273)
This commit is contained in:
1 parent
6d7cdbaf98
commit
20e891544c
3 files changed
+16
-13
No files matched your search
@@ -21,6 +21,7 @@ import {
|
||||
printOptionalToken,
|
||||
printDefiniteToken,
|
||||
printDeclareToken,
|
||||
printTypeScriptAccessibilityToken,
|
||||
} from "./misc.js";
|
||||
import { printPropertyKey } from "./property.js";
|
||||
import { printAssignment } from "./assignment.js";
|
||||
@@ -182,9 +183,8 @@ function printClassMethod(path, options, print) {
|
||||
if (isNonEmptyArray(node.decorators)) {
|
||||
parts.push(printClassMemberDecorators(path, options, print));
|
||||
}
|
||||
if (node.accessibility) {
|
||||
parts.push(node.accessibility + " ");
|
||||
}
|
||||
|
||||
parts.push(printTypeScriptAccessibilityToken(node));
|
||||
|
||||
if (node.static) {
|
||||
parts.push("static ");
|
||||
@@ -209,11 +209,8 @@ function printClassProperty(path, options, print) {
|
||||
if (isNonEmptyArray(node.decorators)) {
|
||||
parts.push(printClassMemberDecorators(path, options, print));
|
||||
}
|
||||
if (node.accessibility) {
|
||||
parts.push(node.accessibility + " ");
|
||||
}
|
||||
|
||||
parts.push(printDeclareToken(path));
|
||||
parts.push(printTypeScriptAccessibilityToken(node), printDeclareToken(path));
|
||||
|
||||
if (node.static) {
|
||||
parts.push("static ");
|
||||
|
||||
@@ -106,6 +106,10 @@ function printDirective(rawText, options) {
|
||||
return enclosingQuote + rawContent + enclosingQuote;
|
||||
}
|
||||
|
||||
function printTypeScriptAccessibilityToken(node) {
|
||||
return node.accessibility ? node.accessibility + " " : "";
|
||||
}
|
||||
|
||||
export {
|
||||
printOptionalToken,
|
||||
printDefiniteToken,
|
||||
@@ -115,4 +119,5 @@ export {
|
||||
printRestSpread,
|
||||
adjustClause,
|
||||
printDirective,
|
||||
printTypeScriptAccessibilityToken,
|
||||
};
|
||||
@@ -22,7 +22,10 @@ import {
|
||||
import isTsKeywordType from "../utils/is-ts-keyword-type.js";
|
||||
import { locStart, locEnd } from "../loc.js";
|
||||
|
||||
import { printOptionalToken } from "./misc.js";
|
||||
import {
|
||||
printOptionalToken,
|
||||
printTypeScriptAccessibilityToken,
|
||||
} from "./misc.js";
|
||||
import { printTernary } from "./ternary.js";
|
||||
import {
|
||||
printFunctionParameters,
|
||||
@@ -178,9 +181,7 @@ function printTypescript(path, options, print) {
|
||||
return parts;
|
||||
|
||||
case "TSParameterProperty":
|
||||
if (node.accessibility) {
|
||||
parts.push(node.accessibility + " ");
|
||||
}
|
||||
parts.push(printTypeScriptAccessibilityToken(node));
|
||||
if (node.export) {
|
||||
parts.push("export ");
|
||||
}
|
||||
@@ -222,7 +223,7 @@ function printTypescript(path, options, print) {
|
||||
|
||||
return [
|
||||
node.export ? "export " : "",
|
||||
node.accessibility ? [node.accessibility, " "] : "",
|
||||
printTypeScriptAccessibilityToken(node),
|
||||
node.static ? "static " : "",
|
||||
node.readonly ? "readonly " : "",
|
||||
printDeclareToken(path),
|
||||
@@ -288,7 +289,7 @@ function printTypescript(path, options, print) {
|
||||
case "TSMethodSignature": {
|
||||
const kind = node.kind && node.kind !== "method" ? `${node.kind} ` : "";
|
||||
parts.push(
|
||||
node.accessibility ? [node.accessibility, " "] : "",
|
||||
printTypeScriptAccessibilityToken(node),
|
||||
kind,
|
||||
node.computed ? "[" : "",
|
||||
print("key"),
|
||||
|
||||
Reference in new issue
Block a user