Clean changelog
This commit is contained in:
1 parent
adf67577ee
commit
266344398c
92 files changed
-2010
No files matched your search
@@ -1,21 +0,0 @@
|
||||
#### An object type in a `declare function` signature now breaks before the return type (#13396 by @thorn0)
|
||||
|
||||
This behavior has been unified with how TypeScript is formatted.
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```jsx
|
||||
// Input
|
||||
declare function bla (props: { a: boolean, b: string, c: number }): Promise<Array<foo>>
|
||||
|
||||
// Prettier stable
|
||||
declare function bla(props: { a: boolean, b: string, c: number }): Promise<
|
||||
Array<foo>
|
||||
>;
|
||||
|
||||
// Prettier main
|
||||
declare function bla(props: {
|
||||
a: boolean;
|
||||
b: string;
|
||||
c: number;
|
||||
}): Promise<Array<foo>>;
|
||||
```
|
||||
@@ -1,27 +0,0 @@
|
||||
#### [BREAKING] Remove support for Flow comments (#13687, #13703 by @thorn0)
|
||||
|
||||
Being a kind of preprocessor, [Flow comments](https://flow.org/blog/2015/02/20/Flow-Comments/) AKA [comment types](https://flow.org/en/docs/types/comments/) are processed on the token level and can't be represented in an AST in the general case. Flow builds the AST as if these special comment tokens didn't exist. Example:
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```js
|
||||
/*:: if */ (x) + y;
|
||||
```
|
||||
|
||||
This is parsed as `if (x) +y;` by Flow and as `x + y;` by JS parsers that don't support Flow.
|
||||
|
||||
Previously, for some special cases, Prettier tried to detect that this syntax was used and to preserve it. As an attempt to solve an unsolvable problem, this limited support was fragile and riddled with bugs, so it has been removed. Now if the `parser` option is set to `flow` or `babel-flow`, Flow comments will be parsed and reprinted like normal code. If a parser that doesn't support Flow is used, they will be treated like usual comments.
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```js
|
||||
// Input
|
||||
let a /*: foo */ = b;
|
||||
|
||||
// Prettier stable
|
||||
let a /*: foo */ = b;
|
||||
|
||||
// Prettier main with --parser flow
|
||||
let a: foo = b;
|
||||
|
||||
// Prettier main with --parser babel
|
||||
let a /*: foo */ = b;
|
||||
```
|
||||
@@ -1,40 +0,0 @@
|
||||
#### [BREAKING] Print trailing comma in type parameters and tuple types when `--trailing-comma=es5` (#14086, #14085 by @fisker)
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```js
|
||||
// Input
|
||||
type Foo = [
|
||||
{
|
||||
from: string,
|
||||
to: string,
|
||||
}, // <- 1
|
||||
];
|
||||
type Foo = Promise<
|
||||
| { ok: true, bar: string, baz: SomeOtherLongType }
|
||||
| { ok: false, bar: SomeOtherLongType }, // <- 2
|
||||
>;
|
||||
|
||||
// Prettier stable
|
||||
type Foo = [
|
||||
{
|
||||
from: string,
|
||||
to: string,
|
||||
} // <- 1
|
||||
];
|
||||
type Foo = Promise<
|
||||
| { ok: true, bar: string, baz: SomeOtherLongType }
|
||||
| { ok: false, bar: SomeOtherLongType } // <- 2
|
||||
>;
|
||||
|
||||
// Prettier main
|
||||
type Foo = [
|
||||
{
|
||||
from: string,
|
||||
to: string,
|
||||
}, // <- 1
|
||||
];
|
||||
type Foo = Promise<
|
||||
| { ok: true, bar: string, baz: SomeOtherLongType }
|
||||
| { ok: false, bar: SomeOtherLongType }, // <- 2
|
||||
>;
|
||||
```
|
||||
@@ -1,17 +0,0 @@
|
||||
#### Support conditional type and infer type (#14573 by @SamChou19815)
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```jsx
|
||||
// Input
|
||||
type TestReturnType<T extends (...args: any[]) => any> = T extends (...args: any[]) => infer R ? R : any;
|
||||
|
||||
// Prettier stable
|
||||
// Does not parse
|
||||
|
||||
// Prettier main
|
||||
type TestReturnType<T extends (...args: any[]) => any> = T extends (
|
||||
...args: any[]
|
||||
) => infer R
|
||||
? R
|
||||
: any;
|
||||
```
|
||||
@@ -1,12 +0,0 @@
|
||||
#### Support Mapped Types and keyof (#14619 by @jbrown215)
|
||||
|
||||
```jsx
|
||||
// Input
|
||||
type Mapped = {[key in keyof O]:number};
|
||||
|
||||
// Prettier stable
|
||||
// Does not parse
|
||||
|
||||
// Prettier main
|
||||
type Mapped = { [key in keyof O]: number };
|
||||
```
|
||||
@@ -1,15 +0,0 @@
|
||||
#### Support type guards (#14767 by @panagosg7)
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```jsx
|
||||
// Input
|
||||
function isString (x: mixed): x is string { return typeof x === "string"; }
|
||||
|
||||
// Prettier stable
|
||||
// Does not parse
|
||||
|
||||
// Prettier main
|
||||
function isString(x: mixed): x is string {
|
||||
return typeof x === 'string';
|
||||
}
|
||||
```
|
||||
Reference in new issue
Block a user