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
Dunqing
3d29e9cb75
fix(isolated-declarations): eliminate imports incorrectly when they are used in TSInferType ( #4043 )
...
close : #4018
2024-07-03 15:32:27 +00:00
Egor Blinov
7768d233c6
feat(isolated-declarations): support optional class methods ( #4035 )
...
Example class
```
export class A {
m1?(): void;
m2(): void {}
}
```
Before the fix:
```
export declare class A {
m1(): void;
}
```
with the fix:
```
export declare class A {
m1?(): void;
m2(): void;
}
```
2024-07-03 09:46:59 +08:00
Egor Blinov
c043bec674
fix(isolated_declarations): add mapped-type constraint to the scope ( #4037 )
...
Fixes https://github.com/oxc-project/oxc/issues/4020
Example:
```ts
import {K} from 'foo'
import {T} from 'bar'
export interface I {
prop: {[key in K]: T}
}
```
Before:
```ts
import {T} from 'bar'
export interface I {
prop: {[key in K]: T}
}
```
After:
```ts
import {K} from 'foo'
import {T} from 'bar'
export interface I {
prop: {[key in K]: T}
}
```
TSC:
```ts
import { K } from 'foo';
import { T } from 'bar';
export interface I {
prop: {
[key in K]: T;
};
}
```
2024-07-03 09:45:03 +08:00
Egor Blinov
b007553ebe
fix(isolated_declarations): Fix readonly specifier on class constructor params ( #4030 )
2024-07-02 23:26:19 +08:00
Egor Blinov
da628399fa
fix(isolated_declarations): inferring literal types for readonly class fileds ( #4027 )
2024-07-02 23:00:37 +08:00
Dunqing
02ea19a3b7
fix(isolated-declarations): should emit export {} when only having ImportDeclaration ( #4026 )
...
close : #4023
2024-07-02 13:47:30 +00:00
Dunqing
7c915f4665
fix(isolated-declarations): binding elements with export should report an error ( #4025 )
...
close : #3976
2024-07-02 13:47:28 +00:00
Dunqing
05a047c17d
fix(isolated-declarations): method following an abstract method gets dropped ( #4024 )
...
close : #4019
2024-07-02 13:47:26 +00:00
Dunqing
bd1141da67
fix(isolated-declarations): if declarations is referenced in declare global then keep it ( #3982 )
...
close : #3981
2024-06-30 11:34:04 +00:00
Boshen
dc6d45e2e6
feat(ast,codegen): add TSParenthesizedType and print type parentheses correctly ( #3979 )
...
closes #3916
2024-06-30 07:57:48 +00:00
Dunqing
51e54f902c
fix(codegen): should print TSModuleDeclarationKind instead of just module ( #3957 )
2024-06-29 05:24:36 +00:00
Dunqing
31e4c3b33e
fix(isolated-declarations): declare global {} should be kept even if it is not exported ( #3956 )
...
close : #3952
2024-06-29 05:07:21 +00:00
Dunqing
27665945f1
fix(codegen): print type parameters for MethodDefinition ( #3922 )
...
close : #3918
2024-06-26 07:21:42 +00:00
Dunqing
27f0531aac
fix(isolated-declarations): private constructor reaching unreachable ( #3921 )
...
fix : #3917
2024-06-26 07:21:38 +00:00
Dunqing
59ce38bb85
fix(isolated-declarations): inferring of UnrayExpression incorrectly ( #3920 )
...
close : #3914
2024-06-26 07:21:35 +00:00
Dunqing
5e2baf3edd
feat(isolated-declarations): report error for expando functions ( #3872 )
...
close : #3703
2024-06-24 10:56:23 +00:00
Boshen
777f12b6fd
chore(isolated-declarations): run integration tests only once
2024-06-24 00:24:16 +08:00
Dunqing
2cdb34f6df
feat(isolated-declarations): support for class function overloads ( #3811 )
2024-06-21 14:37:10 +00:00
Dunqing
58e54f4aea
fix(isolated-declarations): report an error for parameters if they are ObjectPattern or ArrayPattern without an explicit type ( #3810 )
2024-06-21 10:20:28 +00:00
Dunqing
231b8f0946
feat(isolated-declarations): support for export default function overloads ( #3809 )
2024-06-21 10:20:25 +00:00
Dunqing
eadf495e85
chore(isolated-declarations): add tests from Deno ( #3808 )
2024-06-21 10:20:21 +00:00
Dunqing
a37138f1ec
feat(isolated-declarations): improve the inference template literal ( #3797 )
2024-06-20 15:02:45 +00:00
Dunqing
b0d7355c98
feat(isolated-declarations): transform const expression correctly ( #3793 )
2024-06-20 15:02:41 +00:00
Dunqing
2821e0e307
feat(codegen): print readonly keyword for TSIndexSignature ( #3791 )
2024-06-20 10:13:51 +00:00
Dunqing
7d47fc3fcc
fix(isolated-declarations): should stripe async and generator keyword after transformed ( #3790 )
2024-06-20 10:13:44 +00:00
Dunqing
97575d8cab
feat(codegen): print TSClassImplements and TSThisParameter ( #3786 )
...
close: https://github.com/oxc-project/oxc/issues/3692#issuecomment-2178994839
2024-06-20 06:15:23 +00:00
Dunqing
497769cb60
feat(ast): add some visitor functions ( #3785 )
2024-06-20 05:23:04 +00:00
Dunqing
b38c34dfce
feat(isolated-declarations): support inferring ParenthesizedExpression ( #3769 )
2024-06-19 15:43:21 +00:00
Dunqing
8ce794d740
fix(isolated-declarations): inferring an incorrect return type when there is an arrow function inside a function ( #3768 )
2024-06-19 15:43:15 +00:00