3 ms·
Spreads are ordered, and try to match the semantics of object spreads at runtime. Intersection types don't do that, they express that the type is both things at
by Kejistan 4y ago
Spreads are ordered, and try to match the semantics of object spreads at runtime. Intersection types don't do that, they express that the type is both things at the same time. It is most obvious when dealing with types that have overlapping properties: [typescript with intersections](https://www.typescriptlang.org/play?#code/C4TwDgpgBAglC8UDeAoK6oDMD22BcUAdgK4C2ARhAE4DcaG5AhlQQM7BUCWhA5nQL50UAEwgBjADbNoY7IXZRW2UhBgEYQ0JCgAhBMnroc+RR259DUJgC82Z3gKGjJ0qLPnBFyiDoI7N4NAAwvpwAGS6TuJSVNCYxIRiwJxyUMAQ7AAUYgRBAJQEAG7YnMJCAPTlUABExtVQnKxE2ADuUAAGhBCF1O1pgcIo6VmoGFAAdJNKKjAANJaT49M+8-x5mhnAmaMYxgQADPNjTCxQAOTsVGdHDIy255fXKGt0QA https://www.typescriptlang.org/play?#code/C4TwDgpgBAglC8UDeA...) [flow with spreads](https://flow.org/try/#0C4TwDgpgBAglC8UDeAfAUFTUBmB7XAXFAHYCuAtgEYQBOA3BlpQIY1EDOwNAlsQOYMUAXwZoAJhADGAG1bQAbqyjtc5CDCIxRoSFABCCZOiw58HLrwGNMLAF7me-QSLTipsmgqUq1eonu1waABhQyQAOkiYABooSPC9FzcZORxSYklgblxiKGAITgAKSSJggEoieVxuMW0C4EKkazjIn3Vo5vi2vQ6hMtEAegGoAGUAC1xSaTFiAHJgKAB3XBoAayhqSWZSdmg8XChudjmF5mULfjR8oqaTfaIABg6TFjYoWc4aWeemZnt3z7fNB9OhAA https://flow.org/try/#0C4TwDgpgBAglC8UDeAfAUFTUBmB7XAXFAHYCu...).