308c638f7b8fab91dffd6c294e143026c97bc9318dbc276d6174079b7cfb5e885582c68ae7253b516af37b3ff044aeafbd35cf0621a44c7485bd9bdd469a1b 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.TSAnyKeyword = TSAnyKeyword;
  6. exports.TSArrayType = TSArrayType;
  7. exports.TSSatisfiesExpression = exports.TSAsExpression = TSTypeExpression;
  8. exports.TSBigIntKeyword = TSBigIntKeyword;
  9. exports.TSBooleanKeyword = TSBooleanKeyword;
  10. exports.TSCallSignatureDeclaration = TSCallSignatureDeclaration;
  11. exports.TSInterfaceHeritage = exports.TSClassImplements = TSClassImplements;
  12. exports.TSConditionalType = TSConditionalType;
  13. exports.TSConstructSignatureDeclaration = TSConstructSignatureDeclaration;
  14. exports.TSConstructorType = TSConstructorType;
  15. exports.TSDeclareFunction = TSDeclareFunction;
  16. exports.TSDeclareMethod = TSDeclareMethod;
  17. exports.TSEnumBody = TSEnumBody;
  18. exports.TSEnumDeclaration = TSEnumDeclaration;
  19. exports.TSEnumMember = TSEnumMember;
  20. exports.TSExportAssignment = TSExportAssignment;
  21. exports.TSExternalModuleReference = TSExternalModuleReference;
  22. exports.TSFunctionType = TSFunctionType;
  23. exports.TSImportEqualsDeclaration = TSImportEqualsDeclaration;
  24. exports.TSImportType = TSImportType;
  25. exports.TSIndexSignature = TSIndexSignature;
  26. exports.TSIndexedAccessType = TSIndexedAccessType;
  27. exports.TSInferType = TSInferType;
  28. exports.TSInstantiationExpression = TSInstantiationExpression;
  29. exports.TSInterfaceBody = TSInterfaceBody;
  30. exports.TSInterfaceDeclaration = TSInterfaceDeclaration;
  31. exports.TSIntersectionType = TSIntersectionType;
  32. exports.TSIntrinsicKeyword = TSIntrinsicKeyword;
  33. exports.TSLiteralType = TSLiteralType;
  34. exports.TSMappedType = TSMappedType;
  35. exports.TSMethodSignature = TSMethodSignature;
  36. exports.TSModuleBlock = TSModuleBlock;
  37. exports.TSModuleDeclaration = TSModuleDeclaration;
  38. exports.TSNamedTupleMember = TSNamedTupleMember;
  39. exports.TSNamespaceExportDeclaration = TSNamespaceExportDeclaration;
  40. exports.TSNeverKeyword = TSNeverKeyword;
  41. exports.TSNonNullExpression = TSNonNullExpression;
  42. exports.TSNullKeyword = TSNullKeyword;
  43. exports.TSNumberKeyword = TSNumberKeyword;
  44. exports.TSObjectKeyword = TSObjectKeyword;
  45. exports.TSOptionalType = TSOptionalType;
  46. exports.TSParameterProperty = TSParameterProperty;
  47. exports.TSParenthesizedType = TSParenthesizedType;
  48. exports.TSPropertySignature = TSPropertySignature;
  49. exports.TSQualifiedName = TSQualifiedName;
  50. exports.TSRestType = TSRestType;
  51. exports.TSStringKeyword = TSStringKeyword;
  52. exports.TSSymbolKeyword = TSSymbolKeyword;
  53. exports.TSTemplateLiteralType = TSTemplateLiteralType;
  54. exports.TSThisType = TSThisType;
  55. exports.TSTupleType = TSTupleType;
  56. exports.TSTypeAliasDeclaration = TSTypeAliasDeclaration;
  57. exports.TSTypeAnnotation = TSTypeAnnotation;
  58. exports.TSTypeAssertion = TSTypeAssertion;
  59. exports.TSTypeLiteral = TSTypeLiteral;
  60. exports.TSTypeOperator = TSTypeOperator;
  61. exports.TSTypeParameter = TSTypeParameter;
  62. exports.TSTypeParameterDeclaration = exports.TSTypeParameterInstantiation = TSTypeParameterInstantiation;
  63. exports.TSTypePredicate = TSTypePredicate;
  64. exports.TSTypeQuery = TSTypeQuery;
  65. exports.TSTypeReference = TSTypeReference;
  66. exports.TSUndefinedKeyword = TSUndefinedKeyword;
  67. exports.TSUnionType = TSUnionType;
  68. exports.TSUnknownKeyword = TSUnknownKeyword;
  69. exports.TSVoidKeyword = TSVoidKeyword;
  70. exports.tsPrintClassMemberModifiers = tsPrintClassMemberModifiers;
  71. exports.tsPrintFunctionOrConstructorType = tsPrintFunctionOrConstructorType;
  72. exports.tsPrintPropertyOrMethodName = tsPrintPropertyOrMethodName;
  73. exports.tsPrintSignatureDeclarationBase = tsPrintSignatureDeclarationBase;
  74. function TSTypeAnnotation(node, parent) {
  75. this.token((parent.type === "TSFunctionType" || parent.type === "TSConstructorType") && parent.typeAnnotation === node ? "=>" : ":");
  76. this.space();
  77. if (node.optional) this.tokenChar(63);
  78. this.print(node.typeAnnotation);
  79. }
  80. function TSTypeParameterInstantiation(node, parent) {
  81. this.tokenChar(60);
  82. let printTrailingSeparator = parent.type === "ArrowFunctionExpression" && node.params.length === 1;
  83. if (this.tokenMap && node.start != null && node.end != null) {
  84. printTrailingSeparator && (printTrailingSeparator = !!this.tokenMap.find(node, t => this.tokenMap.matchesOriginal(t, ",")));
  85. printTrailingSeparator || (printTrailingSeparator = this.shouldPrintTrailingComma(">"));
  86. }
  87. this.printList(node.params, printTrailingSeparator);
  88. this.tokenChar(62);
  89. }
  90. function TSTypeParameter(node) {
  91. if (node.const) {
  92. this.word("const");
  93. this.space();
  94. }
  95. if (node.in) {
  96. this.word("in");
  97. this.space();
  98. }
  99. if (node.out) {
  100. this.word("out");
  101. this.space();
  102. }
  103. this.word(node.name);
  104. if (node.constraint) {
  105. this.space();
  106. this.word("extends");
  107. this.space();
  108. this.print(node.constraint);
  109. }
  110. if (node.default) {
  111. this.space();
  112. this.tokenChar(61);
  113. this.space();
  114. this.print(node.default);
  115. }
  116. }
  117. function TSParameterProperty(node) {
  118. if (node.accessibility) {
  119. this.word(node.accessibility);
  120. this.space();
  121. }
  122. if (node.readonly) {
  123. this.word("readonly");
  124. this.space();
  125. }
  126. this._param(node.parameter);
  127. }
  128. function TSDeclareFunction(node, parent) {
  129. if (node.declare) {
  130. this.word("declare");
  131. this.space();
  132. }
  133. this._functionHead(node, parent);
  134. this.semicolon();
  135. }
  136. function TSDeclareMethod(node) {
  137. this._classMethodHead(node);
  138. this.semicolon();
  139. }
  140. function TSQualifiedName(node) {
  141. this.print(node.left);
  142. this.tokenChar(46);
  143. this.print(node.right);
  144. }
  145. function TSCallSignatureDeclaration(node) {
  146. this.tsPrintSignatureDeclarationBase(node);
  147. maybePrintTrailingCommaOrSemicolon(this, node);
  148. }
  149. function maybePrintTrailingCommaOrSemicolon(printer, node) {
  150. if (!printer.tokenMap || !node.start || !node.end) {
  151. printer.semicolon();
  152. return;
  153. }
  154. if (printer.tokenMap.endMatches(node, ",")) {
  155. printer.token(",");
  156. } else if (printer.tokenMap.endMatches(node, ";")) {
  157. printer.semicolon();
  158. }
  159. }
  160. function TSConstructSignatureDeclaration(node) {
  161. this.word("new");
  162. this.space();
  163. this.tsPrintSignatureDeclarationBase(node);
  164. maybePrintTrailingCommaOrSemicolon(this, node);
  165. }
  166. function TSPropertySignature(node) {
  167. const {
  168. readonly
  169. } = node;
  170. if (readonly) {
  171. this.word("readonly");
  172. this.space();
  173. }
  174. this.tsPrintPropertyOrMethodName(node);
  175. this.print(node.typeAnnotation);
  176. maybePrintTrailingCommaOrSemicolon(this, node);
  177. }
  178. function tsPrintPropertyOrMethodName(node) {
  179. if (node.computed) {
  180. this.tokenChar(91);
  181. }
  182. this.print(node.key);
  183. if (node.computed) {
  184. this.tokenChar(93);
  185. }
  186. if (node.optional) {
  187. this.tokenChar(63);
  188. }
  189. }
  190. function TSMethodSignature(node) {
  191. const {
  192. kind
  193. } = node;
  194. if (kind === "set" || kind === "get") {
  195. this.word(kind);
  196. this.space();
  197. }
  198. this.tsPrintPropertyOrMethodName(node);
  199. this.tsPrintSignatureDeclarationBase(node);
  200. maybePrintTrailingCommaOrSemicolon(this, node);
  201. }
  202. function TSIndexSignature(node) {
  203. const {
  204. readonly,
  205. static: isStatic
  206. } = node;
  207. if (isStatic) {
  208. this.word("static");
  209. this.space();
  210. }
  211. if (readonly) {
  212. this.word("readonly");
  213. this.space();
  214. }
  215. this.tokenChar(91);
  216. this._parameters(node.parameters, "]");
  217. this.print(node.typeAnnotation);
  218. maybePrintTrailingCommaOrSemicolon(this, node);
  219. }
  220. function TSAnyKeyword() {
  221. this.word("any");
  222. }
  223. function TSBigIntKeyword() {
  224. this.word("bigint");
  225. }
  226. function TSUnknownKeyword() {
  227. this.word("unknown");
  228. }
  229. function TSNumberKeyword() {
  230. this.word("number");
  231. }
  232. function TSObjectKeyword() {
  233. this.word("object");
  234. }
  235. function TSBooleanKeyword() {
  236. this.word("boolean");
  237. }
  238. function TSStringKeyword() {
  239. this.word("string");
  240. }
  241. function TSSymbolKeyword() {
  242. this.word("symbol");
  243. }
  244. function TSVoidKeyword() {
  245. this.word("void");
  246. }
  247. function TSUndefinedKeyword() {
  248. this.word("undefined");
  249. }
  250. function TSNullKeyword() {
  251. this.word("null");
  252. }
  253. function TSNeverKeyword() {
  254. this.word("never");
  255. }
  256. function TSIntrinsicKeyword() {
  257. this.word("intrinsic");
  258. }
  259. function TSThisType() {
  260. this.word("this");
  261. }
  262. function TSFunctionType(node) {
  263. this.tsPrintFunctionOrConstructorType(node);
  264. }
  265. function TSConstructorType(node) {
  266. if (node.abstract) {
  267. this.word("abstract");
  268. this.space();
  269. }
  270. this.word("new");
  271. this.space();
  272. this.tsPrintFunctionOrConstructorType(node);
  273. }
  274. function tsPrintFunctionOrConstructorType(node) {
  275. const {
  276. typeParameters
  277. } = node;
  278. const parameters = node.parameters;
  279. this.print(typeParameters);
  280. this.tokenChar(40);
  281. this._parameters(parameters, ")");
  282. this.space();
  283. const returnType = node.typeAnnotation;
  284. this.print(returnType);
  285. }
  286. function TSTypeReference(node) {
  287. const typeArguments = node.typeParameters;
  288. this.print(node.typeName, !!typeArguments);
  289. this.print(typeArguments);
  290. }
  291. function TSTypePredicate(node) {
  292. if (node.asserts) {
  293. this.word("asserts");
  294. this.space();
  295. }
  296. this.print(node.parameterName);
  297. if (node.typeAnnotation) {
  298. this.space();
  299. this.word("is");
  300. this.space();
  301. this.print(node.typeAnnotation.typeAnnotation);
  302. }
  303. }
  304. function TSTypeQuery(node) {
  305. this.word("typeof");
  306. this.space();
  307. this.print(node.exprName);
  308. const typeArguments = node.typeParameters;
  309. if (typeArguments) {
  310. this.print(typeArguments);
  311. }
  312. }
  313. function TSTypeLiteral(node) {
  314. printBraced(this, node, () => this.printJoin(node.members, true, true));
  315. }
  316. function TSArrayType(node) {
  317. this.print(node.elementType, true);
  318. this.tokenChar(91);
  319. this.tokenChar(93);
  320. }
  321. function TSTupleType(node) {
  322. this.tokenChar(91);
  323. this.printList(node.elementTypes, this.shouldPrintTrailingComma("]"));
  324. this.tokenChar(93);
  325. }
  326. function TSOptionalType(node) {
  327. this.print(node.typeAnnotation);
  328. this.tokenChar(63);
  329. }
  330. function TSRestType(node) {
  331. this.token("...");
  332. this.print(node.typeAnnotation);
  333. }
  334. function TSNamedTupleMember(node) {
  335. this.print(node.label);
  336. if (node.optional) this.tokenChar(63);
  337. this.tokenChar(58);
  338. this.space();
  339. this.print(node.elementType);
  340. }
  341. function TSUnionType(node) {
  342. tsPrintUnionOrIntersectionType(this, node, "|");
  343. }
  344. function TSIntersectionType(node) {
  345. tsPrintUnionOrIntersectionType(this, node, "&");
  346. }
  347. function tsPrintUnionOrIntersectionType(printer, node, sep) {
  348. var _printer$tokenMap;
  349. let hasLeadingToken = 0;
  350. if ((_printer$tokenMap = printer.tokenMap) != null && _printer$tokenMap.startMatches(node, sep)) {
  351. hasLeadingToken = 1;
  352. printer.token(sep);
  353. }
  354. printer.printJoin(node.types, undefined, undefined, function (i) {
  355. this.space();
  356. this.token(sep, null, i + hasLeadingToken);
  357. this.space();
  358. });
  359. }
  360. function TSConditionalType(node) {
  361. this.print(node.checkType);
  362. this.space();
  363. this.word("extends");
  364. this.space();
  365. this.print(node.extendsType);
  366. this.space();
  367. this.tokenChar(63);
  368. this.space();
  369. this.print(node.trueType);
  370. this.space();
  371. this.tokenChar(58);
  372. this.space();
  373. this.print(node.falseType);
  374. }
  375. function TSInferType(node) {
  376. this.word("infer");
  377. this.print(node.typeParameter);
  378. }
  379. function TSParenthesizedType(node) {
  380. this.tokenChar(40);
  381. this.print(node.typeAnnotation);
  382. this.tokenChar(41);
  383. }
  384. function TSTypeOperator(node) {
  385. this.word(node.operator);
  386. this.space();
  387. this.print(node.typeAnnotation);
  388. }
  389. function TSIndexedAccessType(node) {
  390. this.print(node.objectType, true);
  391. this.tokenChar(91);
  392. this.print(node.indexType);
  393. this.tokenChar(93);
  394. }
  395. function TSMappedType(node) {
  396. const {
  397. nameType,
  398. optional,
  399. readonly,
  400. typeAnnotation
  401. } = node;
  402. this.tokenChar(123);
  403. const exit = this.enterDelimited();
  404. this.space();
  405. if (readonly) {
  406. tokenIfPlusMinus(this, readonly);
  407. this.word("readonly");
  408. this.space();
  409. }
  410. this.tokenChar(91);
  411. {
  412. this.word(node.typeParameter.name);
  413. }
  414. this.space();
  415. this.word("in");
  416. this.space();
  417. {
  418. this.print(node.typeParameter.constraint);
  419. }
  420. if (nameType) {
  421. this.space();
  422. this.word("as");
  423. this.space();
  424. this.print(nameType);
  425. }
  426. this.tokenChar(93);
  427. if (optional) {
  428. tokenIfPlusMinus(this, optional);
  429. this.tokenChar(63);
  430. }
  431. if (typeAnnotation) {
  432. this.tokenChar(58);
  433. this.space();
  434. this.print(typeAnnotation);
  435. }
  436. this.space();
  437. exit();
  438. this.tokenChar(125);
  439. }
  440. function tokenIfPlusMinus(self, tok) {
  441. if (tok !== true) {
  442. self.token(tok);
  443. }
  444. }
  445. function TSTemplateLiteralType(node) {
  446. this._printTemplate(node, node.types);
  447. }
  448. function TSLiteralType(node) {
  449. this.print(node.literal);
  450. }
  451. function TSClassImplements(node) {
  452. this.print(node.expression);
  453. this.print(node.typeArguments);
  454. }
  455. function TSInterfaceDeclaration(node) {
  456. const {
  457. declare,
  458. id,
  459. typeParameters,
  460. extends: extendz,
  461. body
  462. } = node;
  463. if (declare) {
  464. this.word("declare");
  465. this.space();
  466. }
  467. this.word("interface");
  468. this.space();
  469. this.print(id);
  470. this.print(typeParameters);
  471. if (extendz != null && extendz.length) {
  472. this.space();
  473. this.word("extends");
  474. this.space();
  475. this.printList(extendz);
  476. }
  477. this.space();
  478. this.print(body);
  479. }
  480. function TSInterfaceBody(node) {
  481. printBraced(this, node, () => this.printJoin(node.body, true, true));
  482. }
  483. function TSTypeAliasDeclaration(node) {
  484. const {
  485. declare,
  486. id,
  487. typeParameters,
  488. typeAnnotation
  489. } = node;
  490. if (declare) {
  491. this.word("declare");
  492. this.space();
  493. }
  494. this.word("type");
  495. this.space();
  496. this.print(id);
  497. this.print(typeParameters);
  498. this.space();
  499. this.tokenChar(61);
  500. this.space();
  501. this.print(typeAnnotation);
  502. this.semicolon();
  503. }
  504. function TSTypeExpression(node) {
  505. const {
  506. type,
  507. expression,
  508. typeAnnotation
  509. } = node;
  510. this.print(expression, true);
  511. this.space();
  512. this.word(type === "TSAsExpression" ? "as" : "satisfies");
  513. this.space();
  514. this.print(typeAnnotation);
  515. }
  516. function TSTypeAssertion(node) {
  517. const {
  518. typeAnnotation,
  519. expression
  520. } = node;
  521. this.tokenChar(60);
  522. this.print(typeAnnotation);
  523. this.tokenChar(62);
  524. this.space();
  525. this.print(expression);
  526. }
  527. function TSInstantiationExpression(node) {
  528. this.print(node.expression);
  529. {
  530. this.print(node.typeParameters);
  531. }
  532. }
  533. function TSEnumDeclaration(node) {
  534. const {
  535. declare,
  536. const: isConst,
  537. id
  538. } = node;
  539. if (declare) {
  540. this.word("declare");
  541. this.space();
  542. }
  543. if (isConst) {
  544. this.word("const");
  545. this.space();
  546. }
  547. this.word("enum");
  548. this.space();
  549. this.print(id);
  550. this.space();
  551. {
  552. TSEnumBody.call(this, node);
  553. }
  554. }
  555. function TSEnumBody(node) {
  556. printBraced(this, node, () => {
  557. var _this$shouldPrintTrai;
  558. return this.printList(node.members, (_this$shouldPrintTrai = this.shouldPrintTrailingComma("}")) != null ? _this$shouldPrintTrai : true, true, true);
  559. });
  560. }
  561. function TSEnumMember(node) {
  562. const {
  563. id,
  564. initializer
  565. } = node;
  566. this.print(id);
  567. if (initializer) {
  568. this.space();
  569. this.tokenChar(61);
  570. this.space();
  571. this.print(initializer);
  572. }
  573. }
  574. function TSModuleDeclaration(node) {
  575. const {
  576. declare,
  577. id,
  578. kind
  579. } = node;
  580. if (declare) {
  581. this.word("declare");
  582. this.space();
  583. }
  584. {
  585. if (!node.global) {
  586. this.word(kind != null ? kind : id.type === "Identifier" ? "namespace" : "module");
  587. this.space();
  588. }
  589. this.print(id);
  590. if (!node.body) {
  591. this.semicolon();
  592. return;
  593. }
  594. let body = node.body;
  595. while (body.type === "TSModuleDeclaration") {
  596. this.tokenChar(46);
  597. this.print(body.id);
  598. body = body.body;
  599. }
  600. this.space();
  601. this.print(body);
  602. }
  603. }
  604. function TSModuleBlock(node) {
  605. printBraced(this, node, () => this.printSequence(node.body, true));
  606. }
  607. function TSImportType(node) {
  608. const {
  609. argument,
  610. qualifier,
  611. options
  612. } = node;
  613. this.word("import");
  614. this.tokenChar(40);
  615. this.print(argument);
  616. if (options) {
  617. this.tokenChar(44);
  618. this.print(options);
  619. }
  620. this.tokenChar(41);
  621. if (qualifier) {
  622. this.tokenChar(46);
  623. this.print(qualifier);
  624. }
  625. const typeArguments = node.typeParameters;
  626. if (typeArguments) {
  627. this.print(typeArguments);
  628. }
  629. }
  630. function TSImportEqualsDeclaration(node) {
  631. const {
  632. id,
  633. moduleReference
  634. } = node;
  635. if (node.isExport) {
  636. this.word("export");
  637. this.space();
  638. }
  639. this.word("import");
  640. this.space();
  641. this.print(id);
  642. this.space();
  643. this.tokenChar(61);
  644. this.space();
  645. this.print(moduleReference);
  646. this.semicolon();
  647. }
  648. function TSExternalModuleReference(node) {
  649. this.token("require(");
  650. this.print(node.expression);
  651. this.tokenChar(41);
  652. }
  653. function TSNonNullExpression(node) {
  654. this.print(node.expression);
  655. this.tokenChar(33);
  656. }
  657. function TSExportAssignment(node) {
  658. this.word("export");
  659. this.space();
  660. this.tokenChar(61);
  661. this.space();
  662. this.print(node.expression);
  663. this.semicolon();
  664. }
  665. function TSNamespaceExportDeclaration(node) {
  666. this.word("export");
  667. this.space();
  668. this.word("as");
  669. this.space();
  670. this.word("namespace");
  671. this.space();
  672. this.print(node.id);
  673. this.semicolon();
  674. }
  675. function tsPrintSignatureDeclarationBase(node) {
  676. const {
  677. typeParameters
  678. } = node;
  679. const parameters = node.parameters;
  680. this.print(typeParameters);
  681. this.tokenChar(40);
  682. this._parameters(parameters, ")");
  683. const returnType = node.typeAnnotation;
  684. this.print(returnType);
  685. }
  686. function tsPrintClassMemberModifiers(node) {
  687. const isPrivateField = node.type === "ClassPrivateProperty";
  688. const isPublicField = node.type === "ClassAccessorProperty" || node.type === "ClassProperty";
  689. printModifiersList(this, node, [isPublicField && node.declare && "declare", !isPrivateField && node.accessibility]);
  690. if (node.static) {
  691. this.word("static");
  692. this.space();
  693. }
  694. printModifiersList(this, node, [!isPrivateField && node.abstract && "abstract", !isPrivateField && node.override && "override", (isPublicField || isPrivateField) && node.readonly && "readonly"]);
  695. }
  696. function printBraced(printer, node, cb) {
  697. printer.token("{");
  698. const exit = printer.enterDelimited();
  699. cb();
  700. exit();
  701. printer.rightBrace(node);
  702. }
  703. function printModifiersList(printer, node, modifiers) {
  704. var _printer$tokenMap2;
  705. const modifiersSet = new Set();
  706. for (const modifier of modifiers) {
  707. if (modifier) modifiersSet.add(modifier);
  708. }
  709. (_printer$tokenMap2 = printer.tokenMap) == null || _printer$tokenMap2.find(node, tok => {
  710. if (modifiersSet.has(tok.value)) {
  711. printer.token(tok.value);
  712. printer.space();
  713. modifiersSet.delete(tok.value);
  714. return modifiersSet.size === 0;
  715. }
  716. });
  717. for (const modifier of modifiersSet) {
  718. printer.word(modifier);
  719. printer.space();
  720. }
  721. }
  722. //# sourceMappingURL=typescript.js.map