Brian Donovan
9bddaef3e5
style: fix formatting
2025-03-02 17:52:04 -08:00
Brian Donovan
23af4519a2
Merge pull request #1415 from spanishpear/master
...
Feat: support Typescript type arguments on tagged template literals
2025-03-02 17:45:33 -08:00
Brian Donovan
6252ec9225
Merge pull request #1406 from mightymeld/2024/06/fix_double_parentheses
...
fix: double parentheses when returning JSXElements using Babel parser
2025-02-26 06:38:35 -08:00
ssomaiya
539b8d3230
Feat: support Typescript type arguments on tagged template literals
2024-11-25 22:17:40 +11:00
tim
2d6919c889
fixes incorrect indentation that could happen with tabs
2024-07-16 23:33:57 +02:00
tim
897a70a8ba
fixes formatting
2024-06-18 18:57:29 +02:00
Brian Donovan
26f21ab437
Merge pull request #1408 from benjamn/refactor/fix-lines-type-annotations
...
refactor: replace `any` type annotations in `Lines`
2024-06-18 09:13:16 -07:00
Brian Donovan
7dee9e08ec
refactor: replace any type annotations in Lines
...
Many of these could just be left inferred.
2024-06-18 09:07:22 -07:00
tim
2bfb82f24a
fixes double parentheses for JSXFragments too
2024-06-18 08:21:05 +02:00
tim
91896cfcfc
avoids double-parentheses on JSXElements
2024-06-18 07:40:40 +02:00
Brian Donovan
5d0ec0a563
fix: prevent removal of trailing JSX whitespace
...
This just re-applies the fix from #1223 by @coderaiser on top of `master`.
2024-06-01 18:08:35 +00:00
Brian Donovan
6f7466ea8e
Merge pull request #1383 from dandean/patch-1
2024-05-31 07:43:54 -07:00
Brian Donovan
b36db43e8d
style: reformat with prettier
2024-05-31 14:34:27 +00:00
Parth Mane
dd8cea468e
chore: Support type parameters on JSX components in TSX (<Foo<Bar> />)
2024-04-08 13:02:00 +05:30
Brian Donovan
bc87a950bb
fix: print export namespace specifiers without braces
...
Fixes #1390
2024-03-03 11:46:01 -08:00
43081j
ed236b84d6
chore: run format
2024-03-02 12:27:04 +00:00
Brian Donovan
efaae58d3d
refactor: replace assert with tiny-invariant
2024-03-01 15:27:32 -08:00
Dan Dean
f0f50943d8
Update printer.ts to support kind = 'get'/'set' on TSMethodSignature
...
`TSMethodSignature` has a `kind` property which can be set to `method` (the default), `get`, and `set`. When `get` and `set`, the method is a getter or a setter, and as such, should be prefixed with either `get ` or `set `.
2024-01-02 17:22:54 -08:00
Brian Donovan
068960405c
fix(print): wrap unary exprs inside ** in parens
...
Closes https://github.com/benjamn/recast/issues/1357
2023-08-10 07:03:13 -07:00
Ash Searle
9292af1162
fix: print ExportSpecifier.exportKind
2023-07-05 21:56:37 +01:00
Brian Donovan
1413bdf5a3
style: apply prettier formatting
2023-05-12 09:25:55 -07:00
coderaiser
65a102da24
fix: improve support of nodes without enclosing
2023-02-12 14:04:34 +02:00
coderaiser
691aa1c96a
feature: improve support of comments inside CallExpression ( benjamn/recast#1272 )
2023-02-12 13:34:10 +02:00
Brian Donovan
63d5431f9a
ensure class member modifiers are printed correctly
2022-12-14 08:28:07 -08:00
Brian Donovan
780487577a
Implement pretty-printer case for ClassAccessorProperty.
...
It's very similar to the one from Babel: f5b52208f0/packages/babel-generator/src/generators/classes.ts (L123-L166) . However, `ast-types` doesn't seem to think a `definite` attribute exists on this node type so the type checking fails.
2022-12-13 07:49:05 -08:00
Ben Newman
e51e1bfe49
Implement pretty-printer case for TSSatisfiesExpression.
...
The printer for the `TSSatisfiesExpression` type is almost identical to
the one for `TSAsExpression`, according to this implementation by Babel:
f5b52208f0/packages/babel-generator/src/generators/typescript.ts (L525-L541)
2022-12-11 15:37:42 -05:00
Ben Newman
e1bc08d78d
Implement pretty-printer case for TSTypeCastExpression.
...
I'm basing this implementation on the following old Babel printer case:
b84f4f2d69/packages/babel-generator/src/generators/typescript.js (L376-L379)
Since I can't find `TSTypeCastExpression` anywhere in the Babel codebase
these days, it might not be used in the wild any longer, but it doesn't
hurt to have a printer case for it, just in case it pops up.
2022-12-11 15:23:42 -05:00
Ben Newman
640acde4c0
Update ast-types to version 0.16.0.
2022-12-11 15:05:14 -05:00
Brian Donovan
413d600a0a
feat(ts): add support for TSInstantiationExpression
...
Refs #1230
See https://devblogs.microsoft.com/typescript/announcing-typescript-4-7-beta/#instantiation-expressions .
This won't work yet because `ast-types` does not yet know about
`TSInstantiationExpression`. Once it does `recast` will need to be
updated to include the newer release of `ast-types`, at which point it
will be supported.
2022-12-11 15:05:14 -05:00
Ben Newman
f76948ecca
Pretty-print semicolons after TSInterfaceBody elements, too.
2022-12-10 18:01:18 -05:00
Ben Newman
1ac55c88e9
Use semicolons in TSTypeLiteral again (not commas though).
...
Follow-up to PR #1157 that I caught while trying to regenerate the
TypeScript declarations for ast-types, and noticed a bunch of (IMHO
reasonable) semicolons going missing.
2022-12-10 17:46:01 -05:00
Dominic Elm
61093a4f49
feat: make lib browser compatible
2022-11-29 12:03:24 +01:00
Greg Price
7891bc75c3
Unify DeclareClass with ClassDeclaration
...
These have so much in common that when they're implemented separately,
it's easy (as the breakage fixed in the previous commit demonstrates)
for one of them to lag behind in getting a feature the other has.
2022-09-27 05:36:14 +00:00
Greg Price
d0a1729f3a
Support Flow "declare class" fully: type parameters, "extends", "implements".
...
This is basically copied from the "ClassDeclaration" case.
There's so much in common between them -- it'd be nice to share
most of this logic.
2022-09-27 05:36:14 +00:00
Brian Donovan
295d7c8028
Merge pull request #1151 from 625dennis/fix-typescript-override-keyword-printer
...
Fix typescript override keyword printer
2022-09-26 22:23:20 -07:00
coderaiser
fbab80418f
fix: print options: quote
2022-09-27 03:26:27 +00:00
hdineen
165e92a297
fix: additional commas in TsTypeLiteral
2022-08-03 10:16:51 -07:00
Dennis Kuduzovic
bc030e5530
add override keyword to printMethod function
2022-07-19 21:34:32 -06:00
Lily Scott
aec4d901fa
Fix #1146
2022-07-12 17:33:05 -06:00
RoXoM
33cc57046d
Fix parenthesis missing
...
Parentheses are missing,
when BinaryExpression child is nullish expression
2022-04-27 23:11:44 +00:00
Georgii Dolzhykov
ba51321748
Reformat all
2022-04-27 23:03:05 +00:00
Brian Donovan
06eca93f28
Merge pull request #1013 from lokshunhung/fix/ts-class-prop-definite
...
Print class property definite assignment assertions
2022-04-27 15:56:37 -07:00
LS Hung
e71ab9bc6a
Test printing definite class property
2022-04-27 22:53:58 +00:00
coderaiser
6e0685ceb1
fix: additional semicolon in TSInterfaceBody
2022-04-27 22:40:08 +00:00
Conrad Buck
eb94a84167
Fix missing parens in reprinted output
2022-04-26 08:49:45 -04:00
Brian Donovan
cb7ff9a333
Merge pull request #1056 from djpohly/pretty-u2028-u2029
2022-02-06 10:19:18 -08:00
Devin J. Pohly
1796f62311
Parenthesize function at start of sequence
...
The firstInStatement function was missing the first child of a
SequenceExpression because it needs to check both the type of the parent
*node* and the name of the parent *path element*, which are not the same
in this case.
This fix is a "minimal change" style; it should be correct even if it's
not beautiful. A cleaner fix would probably involve changing the way
the loop finds nodes.
2022-02-04 08:56:12 -06:00
Devin J. Pohly
7767878ff9
Fix pretty-printing strings with \u2028 or \u2029
...
These two characters are considered ordinary characters by JSON but line
terminators by ECMAScript (prior to ES2019). When pretty-printing a
string containing either character, JSON.stringify leaves it unescaped.
The result in recast.prettyPrint is that fromString, which follows
ECMAScript definitions, converts it mistakenly to a newline character.
Escaping these characters manually when the intent is to generate
ECMAScript (rather than JSON) eliminates the problem.
2022-02-03 14:28:04 -06:00
Ben Newman
abacfa70c3
Allow pretty-printing TopicReference AST nodes.
...
https://github.com/babel/babel/pull/13191
2021-12-02 15:12:45 -05:00
Ben Newman
9a55bb1bc0
Allow pretty-printing V8IntrinsicIdentifier AST nodes.
...
https://github.com/babel/babel/pull/10148
2021-12-02 15:12:44 -05:00