-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
Description
Flow version: 2.106.3 (flow-remove-types).
Note that I'm not entirely clear how the version of flow-remove-types is coupled to flow.
Expected behavior
Flow syntax is removed.
Actual behavior
Most flow syntax is removed, but at this character, the output gets corrupted.
Example
const flowRemoveTypes = require('flow-remove-types')
const contents = `
// @flow
import React, { Component } from 'react'
export const ComponentA = () => (
<div>Component that contains a thing’y</div>
)
export const ComponentB = () => (
<div>Another component that contains a thing’y</div>
)
type Props = {|
name: 'example'
|}
class ExampleComponent extends Component<Props> {
constructor(props: Props) {
super(props)
this.state = {
foo: 'bar',
}
}
render() {
return (
<div>Foo</div>
)
}
}
export default ExampleComponent
`
const removed = flowRemoveTypes(contents, { pretty: true }).toString()
console.log(removed)Expected output:
//
import React, { Component } from 'react'
export const ComponentA = () => (
<div>Component that contains a thing’y</div>
)
export const ComponentB = () => (
<div>Another component that contains a thing’y</div>
)
class ExampleComponent extends Component {
constructor(props) {
super(props)
this.state = {
foo: 'bar',
}
}
render() {
return (
<div>Foo</div>
)
}
}
export default ExampleComponentActual output:
//
import React, { Component } from 'react'
export const ComponentA = () => (
<div>Component that contains a thing’y</div>
)
export const ComponentB = () => (
<div>Another component that contains a thing’y</div>
)
typeass ExampleComponent extends Component<Pro constructor(props: Pr super(props)
this.state = {
foo: 'bar',
}
}
render() {
return (
<div>Foo</div>
)
}
}
export default ExampleComponent