Boshen
82773cb455
feat(codegen): remove underscore from bigint ( #7367 )
...
closes #7285
closes #7286
2024-11-20 09:08:51 +00:00
Song Gao
cf3415b0e4
chore(doc): replace main/master to tag/commit to make the url always accessible ( #7298 )
2024-11-16 21:00:30 +08:00
Dunqing
b74686c598
feat(isolated-declarations): support transform TSExportAssignment declaration ( #7204 )
...
part of #7141
2024-11-08 11:51:41 +00:00
Boshen
6d97af46c7
feat(rust): use oxc-miette ( #6938 )
2024-10-27 13:30:20 +00:00
Boshen
7645e5c34b
refactor(codegen)!: remove CommentOptions API ( #6451 )
2024-10-11 13:53:28 +00:00
Boshen
520096030a
refactor(oxc)!: remove passing Trivias around ( #6446 )
...
part of #6426
2024-10-11 06:09:25 +00:00
Boshen
020bb80b65
refactor(codegen)!: change to CodegenReturn::code and CodegenReturn::map ( #6310 )
2024-10-06 05:05:47 +00:00
Dunqing
e9eeae0f4a
fix(isolated-declarations): false positive for function with a type asserted parameters ( #6181 )
...
close : #6179
2024-10-01 07:57:49 +00:00
Dunqing
a8338ddfe3
fix(isolated-declarations): accidentally collected references of original ast ( #6102 )
2024-09-27 05:43:02 +00:00
michaelm
418ae25f3d
fix(isolated-declarations): Report uninferrable types in arrays ( #6084 )
2024-09-27 07:31:22 +08:00
Dunqing
6b7d3ed613
perf(isolated-declarations): should clone transformed AST rather than original AST ( #6078 )
...
close : #6074
Performance regression introduced by https://github.com/oxc-project/oxc/pull/5909 . After this PR we back to the fold pattern again
2024-09-26 15:50:27 +00:00
michaelm
97a2c41192
fix(isolated-declarations): False positive for class private getter with non-inferrable return type ( #5987 )
...
Fixes a case missing from https://github.com/oxc-project/oxc/pull/5964
Co-authored-by: MichaelMitchell-at <=>
2024-09-23 15:28:29 +08:00
DonIsaac
d6cbbe723c
test(isolated-declarations): arrow function unions in return signature ( #5973 )
2024-09-23 02:44:01 +00:00
Dunqing
fd1c46ca9e
fix(isolated-declarations): infer failed if there are two setter/getter methods that need to be inferred ( #5967 )
2024-09-22 13:41:47 +00:00
Dunqing
6df82eee28
fix(isolated-declarations): false positive for class private method that has arguments without type annotations ( #5964 )
...
close : #5874
2024-09-22 10:10:52 +00:00
Dunqing
6a9e71da46
fix(isolated-declarations): wrap TSFunctionType in parentheses if it is inside the TSUnionType ( #5963 )
2024-09-22 10:10:52 +00:00
Dunqing
4a62703d88
feat(isolated-declarations): handle export in the namespace correctly ( #5950 )
...
Previous I didn't follow the behavior of `TypeScript` to handle `export` in `namespace` as I thought no one used this
2024-09-21 16:39:58 +00:00
Dunqing
ea32d5b156
fix(isolated-declarations): should print constructor assignments first ( #5934 )
2024-09-21 07:52:51 +00:00
Boshen
e148c80fcb
fix(isolated_declarations): try fix fixtures
2024-09-21 01:27:56 +08:00
Boshen
9b3f763a49
fix(isolated_declarations): try fix new line issue
2024-09-21 01:14:40 +08:00
Boshen
ee748b0c05
fix(isolated_declarations): fix fixture spacing
2024-09-21 00:42:59 +08:00
Dunqing
0f96b59990
fix(isolated-declarations): missing print comments in class's private method ( #5931 )
2024-09-20 15:12:01 +00:00
Dunqing
8780c5440f
fix(isolated-declarations): do not union a undefined when the param type is any or unknown ( #5930 )
2024-09-20 15:12:01 +00:00
Dunqing
f07ff14876
fix(isolated-declarations): should not transform signature that has type annotation ( #5927 )
2024-09-20 14:19:04 +00:00
Dunqing
b6a9178075
fix(isolated-declarations): don't collect references when ExportNamedDeclaration has source ( #5926 )
2024-09-20 14:19:03 +00:00
Dunqing
756a571432
fix(isolated-declarations): missing empty export when has an export declare ( #5925 )
2024-09-20 14:19:02 +00:00
Dunqing
2fd5c2a53b
refactor(isolated-declarations): pre-filter statements that do not need to be transformed ( #5909 )
...
We only transform `Declaration` and `ModuleDeclaration` in `IsolatedDeclaration`. We pre-filter statements that need to transform and then use `clone_in` which will avoid producing overhead for clone `Statements`.
2024-09-20 10:18:09 +00:00
Boshen
84a5816d03
feat(isolated_declarations): add stripInternal ( #5878 )
...
closes #3906
closes #5687
closes #3958
---------
Co-authored-by: Dunqing <dengqing0821@gmail.com>
2024-09-19 23:14:47 +08:00
Boshen
dfbde2c602
feat(isolated_declarations): print jsdoc comments ( #5858 )
2024-09-18 14:09:00 +00:00
Boshen
5901d2a0f1
fix(codegen): various spacing issues ( #5820 )
2024-09-17 09:03:28 +00:00
Dunqing
b9bf54494f
fix(isolated-declarations): false positive for setter method in interface ( #5681 )
...
close : #5668
2024-09-10 16:22:08 +00:00
Dunqing
6e8409a020
fix(isolated-declarations): bindings referenced in TSModuleDeclaration are removed incorrectly ( #5680 )
...
close : #5667
2024-09-10 16:22:07 +00:00
overlookmotel
dc924892cc
test: add trailing line breaks to conformance fixtures ( #5541 )
...
Continuation of #5537 . Ensure all conformance fixture files have a trailing line break.
2024-09-06 12:55:17 +00:00
Boshen
1bed5ce2a5
chore: run cargo +nightly fmt to sort imports ( #5503 )
...
They are never going to be stable are they ... cedf7a4daa/.rustfmt.toml (L8-L16)
2024-09-06 04:04:26 +00:00
michaelm
185eb206a8
fix(isolated_declarations): namespaces that are default exported should be considered for expando functions ( #4935 )
...
This should be ok but currently has an error reported
```ts
function foo(): void {}
namespace foo {
export let bar = 42;
}
foo.bar = 42;
export default foo;
```
Co-authored-by: MichaelMitchell-at <=>
Co-authored-by: Dunqing <dengqing0821@gmail.com>
Co-authored-by: Don Isaac <donald.isaac@gmail.com>
2024-08-19 11:24:05 +08:00
michaelm
8e80f593fd
fix(isolated_declarations): Class properties should still be lifted from private constructors ( #4934 )
...
Before, this
```ts
export class Bux {
private constructor(
public readonly prop: number = 0,
private readonly prop2: number = 1,
readonly prop3: number = 1,
) {}
}
```
would be emitted as
```ts
export declare class Bux {
private constructor();
}
```
Now it will be emitted as
```ts
export declare class Bux {
readonly prop: number;
private readonly prop2;
readonly prop3: number;
private constructor();
}
```
Co-authored-by: MichaelMitchell-at <=>
2024-08-16 21:43:44 +08:00
michaelm
b3ec9e50bd
fix(isolated_declarations): Always emit module declarations that perform augmentation ( #4919 )
...
Fixes https://github.com/oxc-project/oxc/issues/4607
Co-authored-by: MichaelMitchell-at <=>
2024-08-16 00:39:28 +08:00
Dunqing
46fb3cbb3e
Revert "fix(isolated_declarations): Always emit module declarations ( #4911 )" ( #4916 )
...
This reverts commit 0fb0b71f0d .
test failed https://github.com/oxc-project/oxc/actions/runs/10405198969/job/28815418191
We should only emit for
```ts
declare module "xx" {}
declare global {}
```
Do not emit for
```ts
module x {}
declare module x {}
```
@MichaelMitchell-at cc
2024-08-15 14:48:28 +00:00
michaelm
0fb0b71f0d
fix(isolated_declarations): Always emit module declarations ( #4911 )
...
Fixes https://github.com/oxc-project/oxc/issues/4607
Co-authored-by: MichaelMitchell-at <=>
2024-08-15 22:13:32 +08:00
michaelm
4a16916887
fix(isolated_declarations): Support expando functions ( #4910 )
...
I mentioned this issue in a
https://github.com/oxc-project/oxc/issues/4607#issuecomment-2264863618
but I later realized this is actually a separate issue from the one that
I originally reported.
It seems that https://github.com/oxc-project/oxc/pull/3872 added support
for reporting expando function errors, but didn't add support for cases
where expando functions are allowed. This PR adds support for not
reporting errors when there is a namespace declaration that declares the
variable being assigned to.
[TypeScript
playground](https://www.typescriptlang.org/play/?noCheck=true&isolatedDeclarations=true&ts=5.5.4#code/KYDwDg9gTgLgBAMwK4DsDGMCWEWIhACgEoAuOANwkwBM4BvAXwCgF8A6AQzDABsBPOAF44xIQD56zJqEiw4aHAGd4AIw5QhI0hSq1BExkzVQ2aDjx6bR+yUzszo8FBwC2wRWA5pgcAHIBleiY4OAc5BRRlOABzfCttShpxWxDYiDYeYBRomAALTQBGAAYmKTCnV3dPbzwIIJDM1XVNABYAJgBuYNDwRzhGuDUAL0Kioq6pVnTjVs6WdmHR8bsAehW4VHLgaiYIqKG44WIyRL0DZgP0mAh-GChMbPjkxiA )
for reference
---------
Co-authored-by: MichaelMitchell-at <=>
2024-08-15 22:12:16 +08:00
Boshen
3d88f20cbb
fix(codegen): print shorthand for all { x } variants ( #4374 )
...
closes #4340
2024-07-21 19:54:21 +08:00
Boshen
3df9e697cc
fix(mangler): no shorthand BindingProperty; handle var hoisting and export variables ( #4319 )
...
Trying to pass tests in https://github.com/oxc-project/monitor-oxc
2024-07-17 18:12:42 +08:00
Boshen
83c2c62f7b
feat(codegen): add option for choosing quotes; remove slow choose_quot method ( #4219 )
2024-07-12 03:08:22 +00:00
Dunqing
cb1af043b8
fix(isolated-declarations): remove the async and generator keywords from MethodDefinition ( #4130 )
...
close : #4120
2024-07-09 03:58:47 +00:00
Dunqing
5c31236d4b
fix(isolated-declarations): keep literal value for readonly property ( #4106 )
...
close : #4036
2024-07-08 06:51:33 +00:00
Dunqing
e67c7d1b01
fix(isolated-declarations): do not infer type for private parameters ( #4105 )
...
close : #4033
2024-07-08 06:51:28 +00:00
michaelm
3fcad5e16f
fix(isolated_declarations): Remove nested AssignmentPatterns from inside parameters ( #4077 )
...
The default values in destructured parameters are retained in
declarations, which can cause captured variables to be part of the emit
when they shouldn't be. This can also lead to unnecessary isolated
declaration errors when those variables are themselves missing type
annotations and can't be inferred.
For example:
```ts
const x = 42;
const y = '';
export function fooGood3({a = x, b: [{c = y}]}: object): void {}
```
before this change will be emitted as:
```ts
declare const x = 42;
declare const y = '';
export declare function fooGood3({ a = x, b: [{ c = y }] }: object): void;
```
and after this change will be emitted as:
```ts
export declare function fooGood3({ a, b: [{ c }] }: object): void;
```
Co-authored-by: MichaelMitchell-at <=>
2024-07-08 11:06:26 +08:00
michaelm
f8d77e4d7a
fix(isolated_declarations): Infer type of template literal expressions as string ( #4068 )
...
In a "non-`const`" context, a template literal string can just be
inferred a `string`. This is consistent with TypeScript's behavior.
Co-authored-by: MichaelMitchell-at <=>
2024-07-08 00:41:33 +08:00
michaelm
adee7280d7
fix(isolated_declarations): Don't report an error for parameters if they are ObjectPattern or ArrayPattern with an explicit type ( #4065 )
...
The logic in https://github.com/oxc-project/oxc/pull/3810 was slightly
off as demonstrated by the snapshot test.
Co-authored-by: MichaelMitchell-at <=>
2024-07-06 22:58:07 +08:00
michaelm
1b8f208572
fix(isolated_declarations): correct emit for private static methods ( #4064 )
2024-07-06 12:30:13 +08:00