Using Prettiefier I noticed that this code block is formated to contain an extra leading pipe, see the following example:
// before Prettier
let foo: {
[k: string]: any
} | boolean;
// after Prettier
const actions:
| {
[k: string]: any;
}
| boolean = true;
Notice the pipe added by Prettier on the type declaration.
This could also be declared in a single line, and prettier keeps the format without adding the extra pipe:
const actions: { [k: string]: any } | boolean = true;
My doubt is why is this pipe added? Does it change anything at the Typescript level?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…