2017-02-24 00:20:08 +01:00
|
|
|
// @out: output.js
|
|
|
|
// @allowJs: true
|
2018-03-26 22:42:34 +02:00
|
|
|
// @checkJs: true
|
|
|
|
// @noImplicitAny: true
|
2017-02-24 00:20:08 +01:00
|
|
|
// @strictNullChecks: true
|
|
|
|
|
|
|
|
// @filename: a.js
|
|
|
|
class C {
|
|
|
|
constructor() {
|
|
|
|
if (Math.random()) {
|
|
|
|
this.inConstructor = 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
this.inConstructor = "string"
|
|
|
|
}
|
2017-02-28 00:58:01 +01:00
|
|
|
this.inMultiple = 0;
|
2017-02-24 00:20:08 +01:00
|
|
|
}
|
|
|
|
method() {
|
|
|
|
if (Math.random()) {
|
|
|
|
this.inMethod = 0;
|
2018-03-26 22:42:34 +02:00
|
|
|
this.inMethodNullable = null;
|
2017-02-24 00:20:08 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
this.inMethod = "string"
|
2018-03-26 22:42:34 +02:00
|
|
|
this.inMethodNullable = undefined;
|
2017-02-24 00:20:08 +01:00
|
|
|
}
|
2017-02-28 00:58:01 +01:00
|
|
|
this.inMultiple = "string";
|
2018-03-26 22:42:34 +02:00
|
|
|
this.inMultipleMethods = "string";
|
2017-03-12 23:00:24 +01:00
|
|
|
|
|
|
|
var action = () => {
|
|
|
|
if (Math.random()) {
|
|
|
|
this.inNestedArrowFunction = 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
this.inNestedArrowFunction = "string"
|
|
|
|
}
|
|
|
|
};
|
2017-02-24 00:20:08 +01:00
|
|
|
}
|
|
|
|
get() {
|
|
|
|
if (Math.random()) {
|
|
|
|
this.inGetter = 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
this.inGetter = "string"
|
|
|
|
}
|
2017-02-28 00:58:01 +01:00
|
|
|
this.inMultiple = false;
|
2018-03-26 22:42:34 +02:00
|
|
|
this.inMultipleMethods = false;
|
2017-02-24 00:20:08 +01:00
|
|
|
}
|
|
|
|
set() {
|
|
|
|
if (Math.random()) {
|
|
|
|
this.inSetter = 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
this.inSetter = "string"
|
|
|
|
}
|
|
|
|
}
|
2017-03-12 23:00:24 +01:00
|
|
|
prop = () => {
|
|
|
|
if (Math.random()) {
|
|
|
|
this.inPropertyDeclaration = 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
this.inPropertyDeclaration = "string"
|
|
|
|
}
|
|
|
|
}
|
2017-02-24 00:20:08 +01:00
|
|
|
static method() {
|
|
|
|
if (Math.random()) {
|
|
|
|
this.inStaticMethod = 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
this.inStaticMethod = "string"
|
|
|
|
}
|
2017-03-12 23:00:24 +01:00
|
|
|
|
|
|
|
var action = () => {
|
|
|
|
if (Math.random()) {
|
|
|
|
this.inStaticNestedArrowFunction = 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
this.inStaticNestedArrowFunction = "string"
|
|
|
|
}
|
|
|
|
};
|
2017-02-24 00:20:08 +01:00
|
|
|
}
|
|
|
|
static get() {
|
|
|
|
if (Math.random()) {
|
|
|
|
this.inStaticGetter = 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
this.inStaticGetter = "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
static set() {
|
|
|
|
if (Math.random()) {
|
|
|
|
this.inStaticSetter = 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
this.inStaticSetter = "string"
|
|
|
|
}
|
|
|
|
}
|
2017-03-12 23:00:24 +01:00
|
|
|
static prop = () => {
|
|
|
|
if (Math.random()) {
|
|
|
|
this.inStaticPropertyDeclaration = 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
this.inStaticPropertyDeclaration = "string"
|
|
|
|
}
|
|
|
|
}
|
2017-02-24 00:20:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// @filename: b.ts
|
|
|
|
var c = new C();
|
|
|
|
|
|
|
|
var stringOrNumber: string | number;
|
|
|
|
var stringOrNumber = c.inConstructor;
|
|
|
|
|
|
|
|
var stringOrNumberOrUndefined: string | number | undefined;
|
|
|
|
|
|
|
|
var stringOrNumberOrUndefined = c.inMethod;
|
|
|
|
var stringOrNumberOrUndefined = c.inGetter;
|
|
|
|
var stringOrNumberOrUndefined = c.inSetter;
|
2017-03-12 23:00:24 +01:00
|
|
|
var stringOrNumberOrUndefined = c.inPropertyDeclaration;
|
|
|
|
var stringOrNumberOrUndefined = c.inNestedArrowFunction
|
2017-02-24 00:20:08 +01:00
|
|
|
|
2017-02-28 00:58:01 +01:00
|
|
|
var stringOrNumberOrBoolean: string | number | boolean;
|
|
|
|
|
2018-03-26 22:42:34 +02:00
|
|
|
var number: number;
|
|
|
|
var number = c.inMultiple;
|
|
|
|
var stringOrBooleanOrUndefined : string | boolean | undefined;
|
|
|
|
var stringOrBooleanOrUndefined = c.inMultipleMethods;
|
|
|
|
var any: any;
|
|
|
|
var any = c.inMethodNullable;
|
2017-02-28 00:58:01 +01:00
|
|
|
|
|
|
|
|
2017-02-24 00:20:08 +01:00
|
|
|
var stringOrNumberOrUndefined = C.inStaticMethod;
|
|
|
|
var stringOrNumberOrUndefined = C.inStaticGetter;
|
|
|
|
var stringOrNumberOrUndefined = C.inStaticSetter;
|
2017-03-12 23:00:24 +01:00
|
|
|
var stringOrNumberOrUndefined = C.inStaticPropertyDeclaration;
|
|
|
|
var stringOrNumberOrUndefined = C.inStaticNestedArrowFunction;
|