facebook / flow

Adds static typing to JavaScript to improve developer productivity and code quality.
https://flow.org/
MIT License
22.08k stars 1.85k forks source link

ES2018: tagged template literals should allow invalid escape sequences #4514

Open mroch opened 7 years ago

mroch commented 7 years ago

https://github.com/tc39/proposal-template-literal-revision is stage 4. tagged template literals should be allowed to have invalid escape sequences like

latex`\unicode{blah}`

see https://github.com/tc39/test262/blob/master/test/language/expressions/tagged-template/invalid-escape-sequences.js for some more examples.

lydell commented 6 years ago

As far as I understand, there are two parts here: (1) parsing and (2) type checking. I’d like to comment on the type checking part.

Consider the latex function in @mroch’s example. Currently, the first parameter of a template-tag-function always has the type Array<string> (as far as I know). I guess that type would need to be changed to something like Array<string | void> & {raw: Array<string>}?