2014-11-07 00:19:27 +01:00
|
|
|
/// <reference path='fourslash.ts'/>
|
|
|
|
|
2016-04-27 18:08:45 +02:00
|
|
|
// @strictNullChecks: true
|
|
|
|
|
2014-11-07 00:19:27 +01:00
|
|
|
////function foo(strOrNum: string | number) {
|
|
|
|
//// if (typeof /*1*/strOrNum === "number") {
|
2018-10-29 18:03:25 +01:00
|
|
|
//// return /*2*/strOrNum;
|
2014-11-07 00:19:27 +01:00
|
|
|
//// }
|
|
|
|
//// else {
|
|
|
|
//// return /*3*/strOrNum.length;
|
|
|
|
//// }
|
|
|
|
////}
|
|
|
|
|
2016-04-27 18:08:45 +02:00
|
|
|
////function bar() {
|
|
|
|
//// let s: string | undefined;
|
|
|
|
//// /*4*/s;
|
|
|
|
//// /*5*/s = "abc";
|
|
|
|
//// /*6*/s;
|
|
|
|
////}
|
|
|
|
|
2018-10-29 18:03:25 +01:00
|
|
|
verify.quickInfos({
|
|
|
|
1: "(parameter) strOrNum: string | number",
|
|
|
|
2: "(parameter) strOrNum: number",
|
|
|
|
3: "(parameter) strOrNum: string",
|
|
|
|
4: "let s: string | undefined",
|
|
|
|
5: "let s: string | undefined",
|
|
|
|
6: "let s: string",
|
|
|
|
});
|
|
|
|
|
|
|
|
verify.completions(
|
|
|
|
{ marker: "1", includes: { name: "strOrNum", text: "(parameter) strOrNum: string | number" } },
|
|
|
|
{ marker: "2", includes: { name: "strOrNum", text: "(parameter) strOrNum: number" } },
|
|
|
|
{ marker: "3", includes: { name: "strOrNum", text: "(parameter) strOrNum: string" } },
|
|
|
|
{ marker: ["4", "5"], includes: { name: "s", text: "let s: string | undefined" } },
|
|
|
|
{ marker: "6", includes: { name: "s", text: "let s: string" } },
|
|
|
|
);
|