2017-02-22 00:59:19 +03:00
|
|
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
|
2018-07-03 09:06:29 +03:00
|
|
|
exports[`exports_optional_prop.js - flow-verify 1`] = `
|
2017-04-12 23:41:51 +03:00
|
|
|
// @flow
|
2016-12-23 22:31:38 +03:00
|
|
|
|
|
|
|
declare class Foo {
|
|
|
|
bar?: () => string
|
|
|
|
}
|
|
|
|
|
|
|
|
export {Foo};
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2016-12-27 21:29:31 +03:00
|
|
|
// @flow
|
2017-01-10 05:49:06 +03:00
|
|
|
|
2017-01-30 20:08:55 +03:00
|
|
|
declare class Foo {
|
2017-09-25 14:45:40 +03:00
|
|
|
bar?: () => string;
|
2017-01-30 20:08:55 +03:00
|
|
|
}
|
2017-01-10 05:49:06 +03:00
|
|
|
|
2017-01-11 18:16:38 +03:00
|
|
|
export { Foo };
|
2017-04-12 23:41:51 +03:00
|
|
|
|
2016-12-23 22:31:38 +03:00
|
|
|
`;
|
|
|
|
|
2018-07-03 09:06:29 +03:00
|
|
|
exports[`test.js - flow-verify 1`] = `
|
2017-04-12 23:41:51 +03:00
|
|
|
class C {
|
2016-12-23 22:31:38 +03:00
|
|
|
C() { }
|
|
|
|
foo() { }
|
|
|
|
static bar() { }
|
|
|
|
qux() { this.constructor.x; }
|
|
|
|
}
|
|
|
|
C.x;
|
|
|
|
(new C).foo.x;
|
|
|
|
C.bar.x;
|
|
|
|
|
2017-02-22 00:59:19 +03:00
|
|
|
import {Foo} from './exports_optional_prop';
|
2016-12-23 22:31:38 +03:00
|
|
|
const foo = new Foo();
|
|
|
|
(foo.bar(): string); // error, could be undefined
|
|
|
|
|
|
|
|
function f(x) {
|
|
|
|
(x.bar(): string); // error. caused by \`f(foo)\`; annotate x to track it down.
|
|
|
|
}
|
|
|
|
f(foo);
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
class C {
|
2017-01-24 20:37:01 +03:00
|
|
|
C() {}
|
|
|
|
foo() {}
|
|
|
|
static bar() {}
|
2016-12-23 22:31:38 +03:00
|
|
|
qux() {
|
|
|
|
this.constructor.x;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
C.x;
|
2017-01-11 02:51:46 +03:00
|
|
|
new C().foo.x;
|
2016-12-23 22:31:38 +03:00
|
|
|
C.bar.x;
|
2017-01-10 05:49:06 +03:00
|
|
|
|
2017-04-12 23:41:51 +03:00
|
|
|
import { Foo } from "./exports_optional_prop";
|
2017-01-11 02:51:46 +03:00
|
|
|
const foo = new Foo();
|
2017-01-26 22:57:43 +03:00
|
|
|
(foo.bar(): string); // error, could be undefined
|
2017-01-31 19:27:44 +03:00
|
|
|
|
2016-12-23 22:31:38 +03:00
|
|
|
function f(x) {
|
2017-01-10 05:49:06 +03:00
|
|
|
(x.bar(): string); // error. caused by \`f(foo)\`; annotate x to track it down.
|
2016-12-23 22:31:38 +03:00
|
|
|
}
|
2017-01-11 18:16:38 +03:00
|
|
|
f(foo);
|
2017-04-12 23:41:51 +03:00
|
|
|
|
2016-12-23 22:31:38 +03:00
|
|
|
`;
|