I've come across some samples for a React DND and within one of them was the following code:
export type Author = {|
id: string,
name: string,
avatarUrl: string,
url: string,
|}
There are several export types like this with the double pipe {|...|}
in object brackets, and, despite my research, I can't find anything that explains what it does. I assume it's due to there being multiple Authors that are combined into the final object (re: the following code) and the double-pipes prevent some sort of conflict.
const princess: Author = {
id: '4',
name: 'Princess bubblegum',
url: '',
avatarUrl: '',
};
export const authors: Author[] = [
jake, BMO, finn, princess,
];
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…