Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flow-remove-types breaks when the source have a long dash "–" #7989

Closed
c58 opened this issue Aug 5, 2019 · 2 comments
Closed

Flow-remove-types breaks when the source have a long dash "–" #7989

c58 opened this issue Aug 5, 2019 · 2 comments

Comments

@c58
Copy link

c58 commented Aug 5, 2019

Flow-remove-types version:
2.104.0

Expected behavior

Successfully remove the types from the following source:

// @flow
function createMessages<T>(a, b: T) {}

const MESSAGES = {
  RECOMMENDED_EXACT_PICKUP_TIME: 'test – test', // <-- long dash here
}

createMessages<typeof MESSAGES>('UIKIT_PICKUP_TIME_FIELD', MESSAGES)

Actual behavior

Exit with error (when used with flow-remove-types/register):

createMessages<t                   'UIKIT_PICKUP_TIME_FIELD',
                            ^

SyntaxError: Invalid or unexpected token
    at Object._compile (/Users/artem/Development/test/node_modules/flow-remove-types/node_modules/pirates/lib/index.js:91:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:789:10)

Steps to reproduce

Run npx flow-node with the source showed above, you will see Unexpected identifier

Findings

Appearantly the problem is with the long-dash symbol. If i replace it with the regular dash - everything worked correctly

@jbrown215
Copy link
Contributor

@motiz88

@mroch
Copy link
Contributor

mroch commented Aug 12, 2019

Duplicate of #7779

this caused by incorrect handling of multibyte characters :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants