Background
I am referring to the ...
operator. Many people like and support the idea of doing the following:
const obj = { "hello": 1 };
const obj2 = { "world": 2, ...obj };
Problem
I personally like this syntax over the typical Object.assign
but recently when I started using it in my project I had this eslint error:
Object Spread - Parsing error: Unexpected token
The solution to this can be seen in the following links:
The problem here is that to use such syntax we need to enable the experimentalObjectRestSpread
flag on eslint. This flag is accompanied by the following warning:
experimentalObjectRestSpread - enable support for the experimental object rest/spread properties (IMPORTANT: This is an experimental feature that may change significantly in the future. It’s recommended that you do not write rules relying on this functionality unless you are willing to incur maintenance cost when it changes.)
After verifying the proposal I realised it is in Stage 3: https://github.com/tc39/proposal-object-rest-spread
More information on the different stages can be seen here:
Question
- What are probabilities of backwards compatibility changes in S3?
- How many proposals have been withdrawn at S3 ?