Unable to Parse Spread Operator

(Ravi Bhatia) #1
ERROR: Parse error at line 65 column 3:

61: import type {EntityDoc} from '@abc/xyz;
62: import type {Custody} from '../../pqr';
64: type PublicEndpointDoc = {|
65:   ...$Exact<EntityDoc>,
66:   endpoint_id: string,
67:   event_ids: Array<string>,
68:   url: string,
69:   member_id: string,
70:   network_name: string,
71: |};

Thank you.

(Fabrice Bellingard) #2

Nobody will help you if you just copy-paste some log. Please edit you post and give more context.

(Colin Brown) #3

I too have run across this. it can’t seem to parse the .JS file if a spread operator is used pre-transpiled (in our case with babel)

(Elena Vilchik) #4

I suspect you are using Flow syntax. Indeed there are some cases we don’t parse it. But note that we plan in future to fully rely on babel parser for Flow (see https://github.com/SonarSource/SonarJS/issues/771). So I suggest you just ignore this parse error for now. Note that since SonarJS 5.0 even if you see this parsing error, part of the rules will be still executed based on babel parser.


(Ravi Bhatia) #5

Thank you Elena. You are correct, this is related to using Flow syntax.