Add support for Flow's proto modifier syntax (#4551)
Flow commit: eb815be907
Babel PR: https://github.com/babel/babel/pull/7978
master
parent
d20d9c160e
commit
fda7bf59f4
|
@ -2675,8 +2675,16 @@ function printPathNoParens(path, options, print, args) {
|
|||
case "ObjectTypeProperty": {
|
||||
const variance = getFlowVariance(n);
|
||||
|
||||
let modifier = "";
|
||||
|
||||
if (n.proto) {
|
||||
modifier = "proto ";
|
||||
} else if (n.static) {
|
||||
modifier = "static ";
|
||||
}
|
||||
|
||||
return concat([
|
||||
n.static ? "static " : "",
|
||||
modifier,
|
||||
isGetterOrSetter(n) ? n.kind + " " : "",
|
||||
variance || "",
|
||||
printPropertyKey(path, options, print),
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`proto_props.js 1`] = `
|
||||
declare class A { proto: T; }
|
||||
declare class B { proto x: T; }
|
||||
declare class C { proto +x: T; }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
declare class A { proto: T }
|
||||
declare class B { proto x: T }
|
||||
declare class C { proto +x: T }
|
||||
|
||||
`;
|
|
@ -0,0 +1 @@
|
|||
run_spec(__dirname, ["flow"]);
|
|
@ -0,0 +1,3 @@
|
|||
declare class A { proto: T; }
|
||||
declare class B { proto x: T; }
|
||||
declare class C { proto +x: T; }
|
Loading…
Reference in New Issue