-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7da07eb
commit 73b138e
Showing
9 changed files
with
123 additions
and
16 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
35 changes: 35 additions & 0 deletions
35
...runtime/src/__tests__/__fixtures__/patternMatching/functionObjectPatternWithAnnotation.js
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,35 @@ | ||
export const integration = { | ||
presets: [ | ||
["@babel/preset-env", {"targets": {"node": "current"}}], | ||
'@babel/preset-flow', | ||
], | ||
plugins: [ | ||
'babel-plugin-flow-runtime', | ||
], | ||
}; | ||
|
||
export const input = ` | ||
class Model { | ||
static init({foo}: {foo: string}) { | ||
} | ||
} | ||
`; | ||
|
||
export const expected = ` | ||
"use strict"; | ||
var _flowRuntime = _interopRequireDefault(require("flow-runtime")); | ||
function _interopRequireDefault(obj) { | ||
return obj && obj.__esModule ? obj : { | ||
default: obj | ||
}; | ||
} @_flowRuntime.default.annotate(_flowRuntime.default.class("Model", _flowRuntime.default.staticMethod("init", _flowRuntime.default.param("_arg", _flowRuntime.default.object(_flowRuntime.default.property("foo", _flowRuntime.default.string())))))) class Model { | ||
static init(_arg) { | ||
let { | ||
foo | ||
} = _arg; | ||
} | ||
} | ||
`; |
38 changes: 38 additions & 0 deletions
38
...gin-flow-runtime/src/__tests__/__fixtures__/patternMatching/functionWithComplexPattern.js
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,38 @@ | ||
export const integration = { | ||
presets: [ | ||
["@babel/preset-env", {"targets": {"node": "current"}}], | ||
'@babel/preset-flow', | ||
], | ||
plugins: [ | ||
'babel-plugin-flow-runtime', | ||
], | ||
}; | ||
|
||
export const input = ` | ||
class Model { | ||
static init({a: [b, {d, e}], f: {g: [h, ...k], i}, ...j}: {a: [number, {d: string, e: number}], f: {g: [string], i: number}}) { | ||
} | ||
} | ||
`; | ||
|
||
export const expected = ` | ||
"use strict"; | ||
var _flowRuntime = _interopRequireDefault(require("flow-runtime")); | ||
function _interopRequireDefault(obj) { | ||
return obj && obj.__esModule ? obj : { | ||
default: obj | ||
}; | ||
} @_flowRuntime.default.annotate(_flowRuntime.default.class("Model", _flowRuntime.default.staticMethod("init", _flowRuntime.default.param("_arg", _flowRuntime.default.object(_flowRuntime.default.property("a", _flowRuntime.default.tuple(_flowRuntime.default.number(), _flowRuntime.default.object(_flowRuntime.default.property("d", _flowRuntime.default.string()), _flowRuntime.default.property("e", _flowRuntime.default.number())))), _flowRuntime.default.property("f", _flowRuntime.default.object(_flowRuntime.default.property("g", _flowRuntime.default.tuple(_flowRuntime.default.string())), _flowRuntime.default.property("i", _flowRuntime.default.number())))))))) class Model { | ||
static init(_arg) { | ||
let { | ||
a: [b, { | ||
d, e | ||
}], f: { | ||
g: [h, ...k], i | ||
}, ...j | ||
} = _arg; | ||
} | ||
} | ||
`; |
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
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
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
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
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
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