-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes error for spread on imported type, resolves #204
- Loading branch information
Showing
3 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`imported-spread 1`] = ` | ||
"'use strict'; | ||
var _other_module = require('./other_module'); | ||
var React = require('react');" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const babel = require('babel-core'); | ||
const content = ` | ||
var React = require('react'); | ||
import { type Foo } from './other_module'; | ||
type Props = {| | ||
id: string, | ||
...Foo, | ||
|} | ||
`; | ||
|
||
it('imported-spread', () => { | ||
const res = babel.transform(content, { | ||
babelrc: false, | ||
presets: ['es2015', 'stage-1', 'react'], | ||
plugins: ['syntax-flow', require('../')], | ||
}).code; | ||
|
||
// The type shouldn't show up as we don't support | ||
// spreads from imports | ||
expect(res).not.toMatch(/Foo/); | ||
|
||
expect(res).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters