Cherry-pick PR #38228 into release-3.9 (#38350)

Component commits:
956ac2132a Allowed comment directives to be multiline

12749c9291 Added tests, and perhaps fixed a test runner bug?

99bb366fd6 I think it's going to need a consistent variable to loop over

a21477d6ac Used dynamically computed indexes in verifies

992441d9b8 Added multiline tests

199d256ba2 Increased flexibility for multiline comment parsing

65a7587432 Undid a couple of formatting changes; removed backslashes from multiline regexp

036a4ae922 Merge branch 'master'

b620104be2 Merge branch 'master' of https://github.com/microsoft/TypeScript into multiline-comment-directives

Co-authored-by: Orta Therox <orta.therox@gmail.com>
This commit is contained in:
TypeScript BotandOrta Therox authored and GitHub committed 2020-05-06 13:11:45 -07:00
1 parent 90570dfe09
commit e261cdd2f6
13 files changed
+767 -208

No files matched your search

+40 -14
View File
@@ -270,9 +270,14 @@ namespace ts {
const unicodeESNextIdentifierPart = [48, 57, 65, 90, 95, 95, 97, 122, 170, 170, 181, 181, 183, 183, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 895, 895, 902, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1327, 1329, 1366, 1369, 1369, 1376, 1416, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1519, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2045, 2045, 2048, 2093, 2112, 2139, 2144, 2154, 2208, 2228, 2230, 2237, 2259, 2273, 2275, 2403, 2406, 2415, 2417, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2556, 2556, 2558, 2558, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2809, 2815, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3072, 3084, 3086, 3088, 3090, 3112, 3114, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3162, 3168, 3171, 3174, 3183, 3200, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3328, 3331, 3333, 3340, 3342, 3344, 3346, 3396, 3398, 3400, 3402, 3406, 3412, 3415, 3423, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3558, 3567, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3718, 3722, 3724, 3747, 3749, 3749, 3751, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4969, 4977, 4992, 5007, 5024, 5109, 5112, 5117, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5880, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6264, 6272, 6314, 6320, 6389, 6400, 6430, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6618, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6832, 6845, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7296, 7304, 7312, 7354, 7357, 7359, 7376, 7378, 7380, 7418, 7424, 7673, 7675, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8472, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12447, 12449, 12538, 12540, 12543, 12549, 12591, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40943, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42737, 42775, 42783, 42786, 42888, 42891, 42943, 42946, 42950, 42999, 43047, 43072, 43123, 43136, 43205, 43216, 43225, 43232, 43255, 43259, 43259, 43261, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43488, 43518, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43824, 43866, 43868, 43879, 43888, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296Line truncated
/**
* Test for whether a comment's text contains a `@ts-expect-error` or `@ts-ignore` directive.
* Test for whether a single line comment's text contains a directive.
*/
const commentDirectiveRegEx = /^\s*\/\/\/?\s*@(ts-expect-error|ts-ignore)/;
const commentDirectiveRegExSingleLine = /^\s*\/\/\/?\s*@(ts-expect-error|ts-ignore)/;
/**
* Test for whether a multi-line comment's last line contains a directive.
*/
const commentDirectiveRegExMultiLine = /^\s*(?:\/|\*)*\s*@(ts-expect-error|ts-ignore)/;
function lookupInUnicodeMap(code: number, map: readonly number[]): boolean {
// Bail out quickly if it couldn't possibly be in the map.
@@ -1735,16 +1740,12 @@ namespace ts {
pos++;
}
const type = getDirectiveFromComment(text.slice(tokenPos, pos));
if (type !== undefined) {
commentDirectives = append(
commentDirectives,
{
range: { pos: tokenPos, end: pos },
type,
},
);
}
commentDirectives = appendIfCommentDirective(
commentDirectives,
text.slice(tokenPos, pos),
commentDirectiveRegExSingleLine,
tokenPos,
);
if (skipTrivia) {
continue;
@@ -1761,6 +1762,7 @@ namespace ts {
}
let commentClosed = false;
let lastLineStart = tokenPos;
while (pos < end) {
const ch = text.charCodeAt(pos);
@@ -1770,12 +1772,16 @@ namespace ts {
break;
}
pos++;
if (isLineBreak(ch)) {
lastLineStart = pos;
tokenFlags |= TokenFlags.PrecedingLineBreak;
}
pos++;
}
commentDirectives = appendIfCommentDirective(commentDirectives, text.slice(lastLineStart, pos), commentDirectiveRegExMultiLine, lastLineStart);
if (!commentClosed) {
error(Diagnostics.Asterisk_Slash_expected);
}
@@ -2118,7 +2124,27 @@ namespace ts {
return token;
}
function getDirectiveFromComment(text: string) {
function appendIfCommentDirective(
commentDirectives: CommentDirective[] | undefined,
text: string,
commentDirectiveRegEx: RegExp,
lineStart: number,
) {
const type = getDirectiveFromComment(text, commentDirectiveRegEx);
if (type === undefined) {
return commentDirectives;
}
return append(
commentDirectives,
{
range: { pos: lineStart, end: pos },
type,
},
);
}
function getDirectiveFromComment(text: string, commentDirectiveRegEx: RegExp) {
const match = commentDirectiveRegEx.exec(text);
if (!match) {
return undefined;
+1 -1
View File
@@ -474,7 +474,7 @@ namespace ts {
export function createCommentDirectivesMap(sourceFile: SourceFile, commentDirectives: CommentDirective[]): CommentDirectivesMap {
const directivesByLine = createMapFromEntries(
commentDirectives.map(commentDirective => ([
`${getLineAndCharacterOfPosition(sourceFile, commentDirective.range.pos).line}`,
`${getLineAndCharacterOfPosition(sourceFile, commentDirective.range.end).line}`,
commentDirective,
]))
);
+145 -140
View File
@@ -832,157 +832,162 @@ module m3 { }\
insertCode(source, index, "Fo");
});
describe("comment directives", () => {
const tsIgnoreComment = "// @ts-ignore";
const textWithIgnoreComment = `const x = 10;
function foo() {
// @ts-ignore
let y: string = x;
return y;
}
function bar() {
// @ts-ignore
let z : string = x;
return z;
}
function bar3() {
// @ts-ignore
let z : string = x;
return z;
}
foo();
bar();
bar3();`;
verifyScenario("when deleting ts-ignore comment", verifyDelete);
verifyScenario("when inserting ts-ignore comment", verifyInsert);
verifyScenario("when changing ts-ignore comment to blah", verifyChangeToBlah);
verifyScenario("when changing blah comment to ts-ignore", verifyChangeBackToDirective);
verifyScenario("when deleting blah comment", verifyDeletingBlah);
verifyScenario("when changing text that adds another comment", verifyChangeDirectiveType);
verifyScenario("when changing text that keeps the comment but adds more nodes", verifyReuseChange);
for (const tsIgnoreComment of [
"// @ts-ignore",
"/* @ts-ignore */",
"/*\n @ts-ignore */"
]) {
describe(`${tsIgnoreComment} comment directives`, () => {
const textWithIgnoreComment = `const x = 10;
function foo() {
${tsIgnoreComment}
let y: string = x;
return y;
}
function bar() {
${tsIgnoreComment}
let z : string = x;
return z;
}
function bar3() {
${tsIgnoreComment}
let z : string = x;
return z;
}
foo();
bar();
bar3();`;
verifyScenario("when deleting ts-ignore comment", verifyDelete);
verifyScenario("when inserting ts-ignore comment", verifyInsert);
verifyScenario("when changing ts-ignore comment to blah", verifyChangeToBlah);
verifyScenario("when changing blah comment to ts-ignore", verifyChangeBackToDirective);
verifyScenario("when deleting blah comment", verifyDeletingBlah);
verifyScenario("when changing text that adds another comment", verifyChangeDirectiveType);
verifyScenario("when changing text that keeps the comment but adds more nodes", verifyReuseChange);
function verifyCommentDirectives(oldText: IScriptSnapshot, newTextAndChange: { text: IScriptSnapshot; textChangeRange: TextChangeRange; }) {
const { incrementalNewTree, newTree } = compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, -1);
assert.deepEqual(incrementalNewTree.commentDirectives, newTree.commentDirectives);
}
function verifyScenario(scenario: string, verifyChange: (atIndex: number, singleIgnore?: true) => void) {
it(`${scenario} - 0`, () => {
verifyChange(0);
});
it(`${scenario} - 1`, () => {
verifyChange(1);
});
it(`${scenario} - 2`, () => {
verifyChange(2);
});
it(`${scenario} - with single ts-ignore`, () => {
verifyChange(0, /*singleIgnore*/ true);
});
}
function getIndexOfTsIgnoreComment(atIndex: number) {
let index: number;
for (let i = 0; i <= atIndex; i++) {
index = textWithIgnoreComment.indexOf(tsIgnoreComment);
function verifyCommentDirectives(oldText: IScriptSnapshot, newTextAndChange: { text: IScriptSnapshot; textChangeRange: TextChangeRange; }) {
const { incrementalNewTree, newTree } = compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, -1);
assert.deepEqual(incrementalNewTree.commentDirectives, newTree.commentDirectives);
}
return index!;
}
function textWithIgnoreCommentFrom(text: string, singleIgnore: true | undefined) {
if (!singleIgnore) return text;
const splits = text.split(tsIgnoreComment);
if (splits.length > 2) {
const tail = splits[splits.length - 2] + splits[splits.length - 1];
splits.length = splits.length - 2;
return splits.join(tsIgnoreComment) + tail;
function verifyScenario(scenario: string, verifyChange: (atIndex: number, singleIgnore?: true) => void) {
it(`${scenario} - 0`, () => {
verifyChange(0);
});
it(`${scenario} - 1`, () => {
verifyChange(1);
});
it(`${scenario} - 2`, () => {
verifyChange(2);
});
it(`${scenario} - with single ts-ignore`, () => {
verifyChange(0, /*singleIgnore*/ true);
});
}
else {
return splits.join(tsIgnoreComment);
function getIndexOfTsIgnoreComment(atIndex: number) {
let index = 0;
for (let i = 0; i <= atIndex; i++) {
index = textWithIgnoreComment.indexOf(tsIgnoreComment, index);
}
return index;
}
}
function verifyDelete(atIndex: number, singleIgnore?: true) {
const index = getIndexOfTsIgnoreComment(atIndex);
const oldText = ScriptSnapshot.fromString(textWithIgnoreCommentFrom(textWithIgnoreComment, singleIgnore));
const newTextAndChange = withDelete(oldText, index, tsIgnoreComment.length);
verifyCommentDirectives(oldText, newTextAndChange);
}
function textWithIgnoreCommentFrom(text: string, singleIgnore: true | undefined) {
if (!singleIgnore) return text;
const splits = text.split(tsIgnoreComment);
if (splits.length > 2) {
const tail = splits[splits.length - 2] + splits[splits.length - 1];
splits.length = splits.length - 2;
return splits.join(tsIgnoreComment) + tail;
}
else {
return splits.join(tsIgnoreComment);
}
}
function verifyInsert(atIndex: number, singleIgnore?: true) {
const index = getIndexOfTsIgnoreComment(atIndex);
const source = textWithIgnoreCommentFrom(textWithIgnoreComment.slice(0, index) + textWithIgnoreComment.slice(index + tsIgnoreComment.length), singleIgnore);
const oldText = ScriptSnapshot.fromString(source);
const newTextAndChange = withInsert(oldText, index, tsIgnoreComment);
verifyCommentDirectives(oldText, newTextAndChange);
}
function verifyDelete(atIndex: number, singleIgnore?: true) {
const index = getIndexOfTsIgnoreComment(atIndex);
const oldText = ScriptSnapshot.fromString(textWithIgnoreCommentFrom(textWithIgnoreComment, singleIgnore));
const newTextAndChange = withDelete(oldText, index, tsIgnoreComment.length);
verifyCommentDirectives(oldText, newTextAndChange);
}
function verifyChangeToBlah(atIndex: number, singleIgnore?: true) {
const index = getIndexOfTsIgnoreComment(atIndex) + "// ".length;
const oldText = ScriptSnapshot.fromString(textWithIgnoreCommentFrom(textWithIgnoreComment, singleIgnore));
const newTextAndChange = withChange(oldText, index, 1, "blah ");
verifyCommentDirectives(oldText, newTextAndChange);
}
function verifyInsert(atIndex: number, singleIgnore?: true) {
const index = getIndexOfTsIgnoreComment(atIndex);
const source = textWithIgnoreCommentFrom(textWithIgnoreComment.slice(0, index) + textWithIgnoreComment.slice(index + tsIgnoreComment.length), singleIgnore);
const oldText = ScriptSnapshot.fromString(source);
const newTextAndChange = withInsert(oldText, index, tsIgnoreComment);
verifyCommentDirectives(oldText, newTextAndChange);
}
function verifyChangeBackToDirective(atIndex: number, singleIgnore?: true) {
const index = getIndexOfTsIgnoreComment(atIndex) + "// ".length;
const source = textWithIgnoreCommentFrom(textWithIgnoreComment.slice(0, index) + "blah " + textWithIgnoreComment.slice(index + 1), singleIgnore);
const oldText = ScriptSnapshot.fromString(source);
const newTextAndChange = withChange(oldText, index, "blah ".length, "@");
verifyCommentDirectives(oldText, newTextAndChange);
}
function verifyChangeToBlah(atIndex: number, singleIgnore?: true) {
const index = getIndexOfTsIgnoreComment(atIndex) + tsIgnoreComment.indexOf("@");
const oldText = ScriptSnapshot.fromString(textWithIgnoreCommentFrom(textWithIgnoreComment, singleIgnore));
const newTextAndChange = withChange(oldText, index, 1, "blah ");
verifyCommentDirectives(oldText, newTextAndChange);
}
function verifyDeletingBlah(atIndex: number, singleIgnore?: true) {
const tsIgnoreIndex = getIndexOfTsIgnoreComment(atIndex);
const index = tsIgnoreIndex + "// ".length;
const source = textWithIgnoreCommentFrom(textWithIgnoreComment.slice(0, index) + "blah " + textWithIgnoreComment.slice(index + 1), singleIgnore);
const oldText = ScriptSnapshot.fromString(source);
const newTextAndChange = withDelete(oldText, tsIgnoreIndex, tsIgnoreComment.length + "blah".length);
verifyCommentDirectives(oldText, newTextAndChange);
}
function verifyChangeBackToDirective(atIndex: number, singleIgnore?: true) {
const index = getIndexOfTsIgnoreComment(atIndex) + tsIgnoreComment.indexOf("@");
const source = textWithIgnoreCommentFrom(textWithIgnoreComment.slice(0, index) + "blah " + textWithIgnoreComment.slice(index + 1), singleIgnore);
const oldText = ScriptSnapshot.fromString(source);
const newTextAndChange = withChange(oldText, index, "blah ".length, "@");
verifyCommentDirectives(oldText, newTextAndChange);
}
function verifyChangeDirectiveType(atIndex: number, singleIgnore?: true) {
const index = getIndexOfTsIgnoreComment(atIndex) + "// @ts-".length;
const oldText = ScriptSnapshot.fromString(textWithIgnoreCommentFrom(textWithIgnoreComment, singleIgnore));
const newTextAndChange = withChange(oldText, index, "ignore".length, "expect-error");
verifyCommentDirectives(oldText, newTextAndChange);
}
function verifyDeletingBlah(atIndex: number, singleIgnore?: true) {
const tsIgnoreIndex = getIndexOfTsIgnoreComment(atIndex);
const index = tsIgnoreIndex + tsIgnoreComment.indexOf("@");
const source = textWithIgnoreCommentFrom(textWithIgnoreComment.slice(0, index) + "blah " + textWithIgnoreComment.slice(index + 1), singleIgnore);
const oldText = ScriptSnapshot.fromString(source);
const newTextAndChange = withDelete(oldText, tsIgnoreIndex, tsIgnoreComment.length + "blah".length);
verifyCommentDirectives(oldText, newTextAndChange);
}
function verifyReuseChange(atIndex: number, singleIgnore?: true) {
const source = `const x = 10;
function foo1() {
const x1 = 10;
// @ts-ignore
let y0: string = x;
let y1: string = x;
return y1;
}
function foo2() {
const x2 = 10;
// @ts-ignore
let y0: string = x;
let y2: string = x;
return y2;
}
function foo3() {
const x3 = 10;
// @ts-ignore
let y0: string = x;
let y3: string = x;
return y3;
}
foo1();
foo2();
foo3();`;
const oldText = ScriptSnapshot.fromString(textWithIgnoreCommentFrom(source, singleIgnore));
const start = source.indexOf(`const x${atIndex + 1}`);
const letStr = `let y${atIndex + 1}: string = x;`;
const end = source.indexOf(letStr) + letStr.length;
const oldSubStr = source.slice(start, end);
const newText = oldSubStr.replace(letStr, `let yn : string = x;`);
const newTextAndChange = withChange(oldText, start, end - start, newText);
verifyCommentDirectives(oldText, newTextAndChange);
}
});
function verifyChangeDirectiveType(atIndex: number, singleIgnore?: true) {
const index = getIndexOfTsIgnoreComment(atIndex) + tsIgnoreComment.indexOf("ignore");
const oldText = ScriptSnapshot.fromString(textWithIgnoreCommentFrom(textWithIgnoreComment, singleIgnore));
const newTextAndChange = withChange(oldText, index, "ignore".length, "expect-error");
verifyCommentDirectives(oldText, newTextAndChange);
}
function verifyReuseChange(atIndex: number, singleIgnore?: true) {
const source = `const x = 10;
function foo1() {
const x1 = 10;
${tsIgnoreComment}
let y0: string = x;
let y1: string = x;
return y1;
}
function foo2() {
const x2 = 10;
${tsIgnoreComment}
let y0: string = x;
let y2: string = x;
return y2;
}
function foo3() {
const x3 = 10;
${tsIgnoreComment}
let y0: string = x;
let y3: string = x;
return y3;
}
foo1();
foo2();
foo3();`;
const oldText = ScriptSnapshot.fromString(textWithIgnoreCommentFrom(source, singleIgnore));
const start = source.indexOf(`const x${atIndex + 1}`);
const letStr = `let y${atIndex + 1}: string = x;`;
const end = source.indexOf(letStr) + letStr.length;
const oldSubStr = source.slice(start, end);
const newText = oldSubStr.replace(letStr, `let yn : string = x;`);
const newTextAndChange = withChange(oldText, start, end - start, newText);
verifyCommentDirectives(oldText, newTextAndChange);
}
});
}
});
}
@@ -0,0 +1,60 @@
tests/cases/conformance/directives/a.ts(12,1): error TS2578: Unused '@ts-expect-error' directive.
tests/cases/conformance/directives/b.tsx(32,1): error TS2578: Unused '@ts-expect-error' directive.
==== tests/cases/conformance/directives/a.ts (1 errors) ====
export const texts: string[] = [];
/**
@ts-ignore */
texts.push(100);
/**
@ts-expect-error */
texts.push(100);
/**
@ts-expect-error */
~~~~~~~~~~~~~~~~~~~~
!!! error TS2578: Unused '@ts-expect-error' directive.
texts.push("100");
==== tests/cases/conformance/directives/b.tsx (1 errors) ====
import * as React from "react";
export function MyComponent(props: { foo: string }) {
return <div />;
}
let x = (
<div>
{/*
@ts-ignore */}
<MyComponent foo={100} />
{/*@ts-ignore*/}
<MyComponent foo={100} />
{/*
@ts-expect-error */}
<MyComponent foo={100} />
{/*
// @ts-expect-error */}
<MyComponent foo={100} />
{/*
* @ts-expect-error */}
<MyComponent foo={100} />
{/*@ts-expect-error*/}
<MyComponent foo={100} />
{/*
@ts-expect-error */}
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2578: Unused '@ts-expect-error' directive.
<MyComponent foo={"hooray"} />
</div>
);
+86
View File
@@ -0,0 +1,86 @@
//// [tests/cases/conformance/directives/multiline.tsx] ////
//// [a.ts]
export const texts: string[] = [];
/**
@ts-ignore */
texts.push(100);
/**
@ts-expect-error */
texts.push(100);
/**
@ts-expect-error */
texts.push("100");
//// [b.tsx]
import * as React from "react";
export function MyComponent(props: { foo: string }) {
return <div />;
}
let x = (
<div>
{/*
@ts-ignore */}
<MyComponent foo={100} />
{/*@ts-ignore*/}
<MyComponent foo={100} />
{/*
@ts-expect-error */}
<MyComponent foo={100} />
{/*
// @ts-expect-error */}
<MyComponent foo={100} />
{/*
* @ts-expect-error */}
<MyComponent foo={100} />
{/*@ts-expect-error*/}
<MyComponent foo={100} />
{/*
@ts-expect-error */}
<MyComponent foo={"hooray"} />
</div>
);
//// [a.js]
"use strict";
exports.__esModule = true;
exports.texts = void 0;
exports.texts = [];
/**
@ts-ignore */
exports.texts.push(100);
/**
@ts-expect-error */
exports.texts.push(100);
/**
@ts-expect-error */
exports.texts.push("100");
//// [b.js]
"use strict";
exports.__esModule = true;
exports.MyComponent = void 0;
var React = require("react");
function MyComponent(props) {
return React.createElement("div", null);
}
exports.MyComponent = MyComponent;
var x = (React.createElement("div", null,
React.createElement(MyComponent, { foo: 100 }),
React.createElement(MyComponent, { foo: 100 }),
React.createElement(MyComponent, { foo: 100 }),
React.createElement(MyComponent, { foo: 100 }),
React.createElement(MyComponent, { foo: 100 }),
React.createElement(MyComponent, { foo: 100 }),
React.createElement(MyComponent, { foo: "hooray" })));
@@ -0,0 +1,89 @@
=== tests/cases/conformance/directives/a.ts ===
export const texts: string[] = [];
>texts : Symbol(texts, Decl(a.ts, 0, 12))
/**
@ts-ignore */
texts.push(100);
>texts.push : Symbol(Array.push, Decl(lib.d.ts, --, --))
>texts : Symbol(texts, Decl(a.ts, 0, 12))
>push : Symbol(Array.push, Decl(lib.d.ts, --, --))
/**
@ts-expect-error */
texts.push(100);
>texts.push : Symbol(Array.push, Decl(lib.d.ts, --, --))
>texts : Symbol(texts, Decl(a.ts, 0, 12))
>push : Symbol(Array.push, Decl(lib.d.ts, --, --))
/**
@ts-expect-error */
texts.push("100");
>texts.push : Symbol(Array.push, Decl(lib.d.ts, --, --))
>texts : Symbol(texts, Decl(a.ts, 0, 12))
>push : Symbol(Array.push, Decl(lib.d.ts, --, --))
=== tests/cases/conformance/directives/b.tsx ===
import * as React from "react";
>React : Symbol(React, Decl(b.tsx, 0, 6))
export function MyComponent(props: { foo: string }) {
>MyComponent : Symbol(MyComponent, Decl(b.tsx, 0, 31))
>props : Symbol(props, Decl(b.tsx, 2, 28))
>foo : Symbol(foo, Decl(b.tsx, 2, 36))
return <div />;
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
}
let x = (
>x : Symbol(x, Decl(b.tsx, 6, 3))
<div>
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
{/*
@ts-ignore */}
<MyComponent foo={100} />
>MyComponent : Symbol(MyComponent, Decl(b.tsx, 0, 31))
>foo : Symbol(foo, Decl(b.tsx, 10, 16))
{/*@ts-ignore*/}
<MyComponent foo={100} />
>MyComponent : Symbol(MyComponent, Decl(b.tsx, 0, 31))
>foo : Symbol(foo, Decl(b.tsx, 13, 16))
{/*
@ts-expect-error */}
<MyComponent foo={100} />
>MyComponent : Symbol(MyComponent, Decl(b.tsx, 0, 31))
>foo : Symbol(foo, Decl(b.tsx, 17, 16))
{/*
// @ts-expect-error */}
<MyComponent foo={100} />
>MyComponent : Symbol(MyComponent, Decl(b.tsx, 0, 31))
>foo : Symbol(foo, Decl(b.tsx, 21, 16))
{/*
* @ts-expect-error */}
<MyComponent foo={100} />
>MyComponent : Symbol(MyComponent, Decl(b.tsx, 0, 31))
>foo : Symbol(foo, Decl(b.tsx, 25, 16))
{/*@ts-expect-error*/}
<MyComponent foo={100} />
>MyComponent : Symbol(MyComponent, Decl(b.tsx, 0, 31))
>foo : Symbol(foo, Decl(b.tsx, 28, 16))
{/*
@ts-expect-error */}
<MyComponent foo={"hooray"} />
>MyComponent : Symbol(MyComponent, Decl(b.tsx, 0, 31))
>foo : Symbol(foo, Decl(b.tsx, 32, 16))
</div>
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
);
+113
View File
@@ -0,0 +1,113 @@
=== tests/cases/conformance/directives/a.ts ===
export const texts: string[] = [];
>texts : string[]
>[] : undefined[]
/**
@ts-ignore */
texts.push(100);
>texts.push(100) : number
>texts.push : (...items: string[]) => number
>texts : string[]
>push : (...items: string[]) => number
>100 : 100
/**
@ts-expect-error */
texts.push(100);
>texts.push(100) : number
>texts.push : (...items: string[]) => number
>texts : string[]
>push : (...items: string[]) => number
>100 : 100
/**
@ts-expect-error */
texts.push("100");
>texts.push("100") : number
>texts.push : (...items: string[]) => number
>texts : string[]
>push : (...items: string[]) => number
>"100" : "100"
=== tests/cases/conformance/directives/b.tsx ===
import * as React from "react";
>React : typeof React
export function MyComponent(props: { foo: string }) {
>MyComponent : (props: { foo: string;}) => JSX.Element
>props : { foo: string; }
>foo : string
return <div />;
><div /> : JSX.Element
>div : any
}
let x = (
>x : JSX.Element
>( <div> {/* @ts-ignore */} <MyComponent foo={100} /> {/*@ts-ignore*/} <MyComponent foo={100} /> {/* @ts-expect-error */} <MyComponent foo={100} /> {/* // @ts-expect-error */} <MyComponent foo={100} /> {/* * @ts-expect-error */} <MyComponent foo={100} /> {/*@ts-expect-error*/} <MyComponent foo={100} /> {/* @ts-expect-error */} <MyComponent foo={"hooray"} /> </div>) : JSX.Element
<div>
><div> {/* @ts-ignore */} <MyComponent foo={100} /> {/*@ts-ignore*/} <MyComponent foo={100} /> {/* @ts-expect-error */} <MyComponent foo={100} /> {/* // @ts-expect-error */} <MyComponent foo={100} /> {/* * @ts-expect-error */} <MyComponent foo={100} /> {/*@ts-expect-error*/} <MyComponent foo={100} /> {/* @ts-expect-error */} <MyComponent foo={"hooray"} /> </div> : JSX.Element
>div : any
{/*
@ts-ignore */}
<MyComponent foo={100} />
><MyComponent foo={100} /> : JSX.Element
>MyComponent : (props: { foo: string; }) => JSX.Element
>foo : number
>100 : 100
{/*@ts-ignore*/}
<MyComponent foo={100} />
><MyComponent foo={100} /> : JSX.Element
>MyComponent : (props: { foo: string; }) => JSX.Element
>foo : number
>100 : 100
{/*
@ts-expect-error */}
<MyComponent foo={100} />
><MyComponent foo={100} /> : JSX.Element
>MyComponent : (props: { foo: string; }) => JSX.Element
>foo : number
>100 : 100
{/*
// @ts-expect-error */}
<MyComponent foo={100} />
><MyComponent foo={100} /> : JSX.Element
>MyComponent : (props: { foo: string; }) => JSX.Element
>foo : number
>100 : 100
{/*
* @ts-expect-error */}
<MyComponent foo={100} />
><MyComponent foo={100} /> : JSX.Element
>MyComponent : (props: { foo: string; }) => JSX.Element
>foo : number
>100 : 100
{/*@ts-expect-error*/}
<MyComponent foo={100} />
><MyComponent foo={100} /> : JSX.Element
>MyComponent : (props: { foo: string; }) => JSX.Element
>foo : number
>100 : 100
{/*
@ts-expect-error */}
<MyComponent foo={"hooray"} />
><MyComponent foo={"hooray"} /> : JSX.Element
>MyComponent : (props: { foo: string; }) => JSX.Element
>foo : string
>"hooray" : "hooray"
</div>
>div : any
);
@@ -1,27 +1,54 @@
tests/cases/conformance/directives/ts-expect-error.ts(4,1): error TS2578: Unused '@ts-expect-error' directive.
tests/cases/conformance/directives/ts-expect-error.ts(10,1): error TS2578: Unused '@ts-expect-error' directive.
tests/cases/conformance/directives/ts-expect-error.ts(13,5): error TS2322: Type '"nope"' is not assignable to type 'number'.
tests/cases/conformance/directives/ts-expect-error.ts(19,2): error TS2367: This condition will always return 'false' since the types 'true' and 'false' have no overlap.
tests/cases/conformance/directives/ts-expect-error.ts(21,2): error TS2367: This condition will always return 'false' since the types 'true' and 'false' have no overlap.
tests/cases/conformance/directives/ts-expect-error.ts(22,2): error TS2367: This condition will always return 'false' since the types 'true' and 'false' have no overlap.
tests/cases/conformance/directives/ts-expect-error.ts(8,1): error TS2578: Unused '@ts-expect-error' directive.
tests/cases/conformance/directives/ts-expect-error.ts(11,1): error TS2578: Unused '@ts-expect-error' directive.
tests/cases/conformance/directives/ts-expect-error.ts(21,1): error TS2578: Unused '@ts-expect-error' directive.
tests/cases/conformance/directives/ts-expect-error.ts(24,1): error TS2578: Unused '@ts-expect-error' directive.
tests/cases/conformance/directives/ts-expect-error.ts(28,1): error TS2578: Unused '@ts-expect-error' directive.
tests/cases/conformance/directives/ts-expect-error.ts(31,5): error TS2322: Type '"nope"' is not assignable to type 'number'.
tests/cases/conformance/directives/ts-expect-error.ts(37,2): error TS2367: This condition will always return 'false' since the types 'true' and 'false' have no overlap.
tests/cases/conformance/directives/ts-expect-error.ts(39,2): error TS2367: This condition will always return 'false' since the types 'true' and 'false' have no overlap.
tests/cases/conformance/directives/ts-expect-error.ts(40,2): error TS2367: This condition will always return 'false' since the types 'true' and 'false' have no overlap.
==== tests/cases/conformance/directives/ts-expect-error.ts (6 errors) ====
==== tests/cases/conformance/directives/ts-expect-error.ts (9 errors) ====
// @ts-expect-error additional commenting
var invalidCommentedFancy: number = 'nope';
var invalidCommentedFancySingle: number = 'nope';
/*
@ts-expect-error additional commenting */
var invalidCommentedFancyMulti: number = 'nope';
// @ts-expect-error additional commenting
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2578: Unused '@ts-expect-error' directive.
var validCommentedFancy: string = 'nope';
var validCommentedFancySingle: string = 'nope';
/* @ts-expect-error additional commenting */
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2578: Unused '@ts-expect-error' directive.
var validCommentedFancyMulti: string = 'nope';
// @ts-expect-error
var invalidCommentedPlain: number = 'nope';
var invalidCommentedPlainSingle: number = 'nope';
/*
@ts-expect-error */
var invalidCommentedPlainMulti: number = 'nope';
// @ts-expect-error
~~~~~~~~~~~~~~~~~~~
!!! error TS2578: Unused '@ts-expect-error' directive.
var validCommentedPlain: string = 'nope';
var validCommentedPlainSingle: string = 'nope';
/* @ts-expect-error */
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2578: Unused '@ts-expect-error' directive.
var validCommentedPlainMulti1: string = 'nope';
/*
@ts-expect-error */
~~~~~~~~~~~~~~~~~~~
!!! error TS2578: Unused '@ts-expect-error' directive.
var validCommentedPlainMulti2: string = 'nope';
var invalidPlain: number = 'nope';
~~~~~~~~~~~~
+39 -8
View File
@@ -1,15 +1,33 @@
//// [ts-expect-error.ts]
// @ts-expect-error additional commenting
var invalidCommentedFancy: number = 'nope';
var invalidCommentedFancySingle: number = 'nope';
/*
@ts-expect-error additional commenting */
var invalidCommentedFancyMulti: number = 'nope';
// @ts-expect-error additional commenting
var validCommentedFancy: string = 'nope';
var validCommentedFancySingle: string = 'nope';
/* @ts-expect-error additional commenting */
var validCommentedFancyMulti: string = 'nope';
// @ts-expect-error
var invalidCommentedPlain: number = 'nope';
var invalidCommentedPlainSingle: number = 'nope';
/*
@ts-expect-error */
var invalidCommentedPlainMulti: number = 'nope';
// @ts-expect-error
var validCommentedPlain: string = 'nope';
var validCommentedPlainSingle: string = 'nope';
/* @ts-expect-error */
var validCommentedPlainMulti1: string = 'nope';
/*
@ts-expect-error */
var validCommentedPlainMulti2: string = 'nope';
var invalidPlain: number = 'nope';
@@ -24,13 +42,26 @@ var validPlain: string = 'nope';
//// [ts-expect-error.js]
// @ts-expect-error additional commenting
var invalidCommentedFancy = 'nope';
var invalidCommentedFancySingle = 'nope';
/*
@ts-expect-error additional commenting */
var invalidCommentedFancyMulti = 'nope';
// @ts-expect-error additional commenting
var validCommentedFancy = 'nope';
var validCommentedFancySingle = 'nope';
/* @ts-expect-error additional commenting */
var validCommentedFancyMulti = 'nope';
// @ts-expect-error
var invalidCommentedPlain = 'nope';
var invalidCommentedPlainSingle = 'nope';
/*
@ts-expect-error */
var invalidCommentedPlainMulti = 'nope';
// @ts-expect-error
var validCommentedPlain = 'nope';
var validCommentedPlainSingle = 'nope';
/* @ts-expect-error */
var validCommentedPlainMulti1 = 'nope';
/*
@ts-expect-error */
var validCommentedPlainMulti2 = 'nope';
var invalidPlain = 'nope';
var validPlain = 'nope';
// @ts-expect-error
@@ -1,44 +1,67 @@
=== tests/cases/conformance/directives/ts-expect-error.ts ===
// @ts-expect-error additional commenting
var invalidCommentedFancy: number = 'nope';
>invalidCommentedFancy : Symbol(invalidCommentedFancy, Decl(ts-expect-error.ts, 1, 3))
var invalidCommentedFancySingle: number = 'nope';
>invalidCommentedFancySingle : Symbol(invalidCommentedFancySingle, Decl(ts-expect-error.ts, 1, 3))
/*
@ts-expect-error additional commenting */
var invalidCommentedFancyMulti: number = 'nope';
>invalidCommentedFancyMulti : Symbol(invalidCommentedFancyMulti, Decl(ts-expect-error.ts, 5, 3))
// @ts-expect-error additional commenting
var validCommentedFancy: string = 'nope';
>validCommentedFancy : Symbol(validCommentedFancy, Decl(ts-expect-error.ts, 4, 3))
var validCommentedFancySingle: string = 'nope';
>validCommentedFancySingle : Symbol(validCommentedFancySingle, Decl(ts-expect-error.ts, 8, 3))
/* @ts-expect-error additional commenting */
var validCommentedFancyMulti: string = 'nope';
>validCommentedFancyMulti : Symbol(validCommentedFancyMulti, Decl(ts-expect-error.ts, 11, 3))
// @ts-expect-error
var invalidCommentedPlain: number = 'nope';
>invalidCommentedPlain : Symbol(invalidCommentedPlain, Decl(ts-expect-error.ts, 7, 3))
var invalidCommentedPlainSingle: number = 'nope';
>invalidCommentedPlainSingle : Symbol(invalidCommentedPlainSingle, Decl(ts-expect-error.ts, 14, 3))
/*
@ts-expect-error */
var invalidCommentedPlainMulti: number = 'nope';
>invalidCommentedPlainMulti : Symbol(invalidCommentedPlainMulti, Decl(ts-expect-error.ts, 18, 3))
// @ts-expect-error
var validCommentedPlain: string = 'nope';
>validCommentedPlain : Symbol(validCommentedPlain, Decl(ts-expect-error.ts, 10, 3))
var validCommentedPlainSingle: string = 'nope';
>validCommentedPlainSingle : Symbol(validCommentedPlainSingle, Decl(ts-expect-error.ts, 21, 3))
/* @ts-expect-error */
var validCommentedPlainMulti1: string = 'nope';
>validCommentedPlainMulti1 : Symbol(validCommentedPlainMulti1, Decl(ts-expect-error.ts, 24, 3))
/*
@ts-expect-error */
var validCommentedPlainMulti2: string = 'nope';
>validCommentedPlainMulti2 : Symbol(validCommentedPlainMulti2, Decl(ts-expect-error.ts, 28, 3))
var invalidPlain: number = 'nope';
>invalidPlain : Symbol(invalidPlain, Decl(ts-expect-error.ts, 12, 3))
>invalidPlain : Symbol(invalidPlain, Decl(ts-expect-error.ts, 30, 3))
var validPlain: string = 'nope';
>validPlain : Symbol(validPlain, Decl(ts-expect-error.ts, 14, 3))
>validPlain : Symbol(validPlain, Decl(ts-expect-error.ts, 32, 3))
// @ts-expect-error
(({ a: true } as const).a === false); // <-- compiles (as expected via comment)
>({ a: true } as const).a : Symbol(a, Decl(ts-expect-error.ts, 17, 3))
>a : Symbol(a, Decl(ts-expect-error.ts, 17, 3))
>a : Symbol(a, Decl(ts-expect-error.ts, 17, 3))
>({ a: true } as const).a : Symbol(a, Decl(ts-expect-error.ts, 35, 3))
>a : Symbol(a, Decl(ts-expect-error.ts, 35, 3))
>a : Symbol(a, Decl(ts-expect-error.ts, 35, 3))
(({ a: true } as const).a === false); // Should error
>({ a: true } as const).a : Symbol(a, Decl(ts-expect-error.ts, 18, 3))
>a : Symbol(a, Decl(ts-expect-error.ts, 18, 3))
>a : Symbol(a, Decl(ts-expect-error.ts, 18, 3))
>({ a: true } as const).a : Symbol(a, Decl(ts-expect-error.ts, 36, 3))
>a : Symbol(a, Decl(ts-expect-error.ts, 36, 3))
>a : Symbol(a, Decl(ts-expect-error.ts, 36, 3))
(({ a: true } as const).a === false); // error
>({ a: true } as const).a : Symbol(a, Decl(ts-expect-error.ts, 20, 3))
>a : Symbol(a, Decl(ts-expect-error.ts, 20, 3))
>a : Symbol(a, Decl(ts-expect-error.ts, 20, 3))
>({ a: true } as const).a : Symbol(a, Decl(ts-expect-error.ts, 38, 3))
>a : Symbol(a, Decl(ts-expect-error.ts, 38, 3))
>a : Symbol(a, Decl(ts-expect-error.ts, 38, 3))
(({ a: true } as const).a === false); // error
>({ a: true } as const).a : Symbol(a, Decl(ts-expect-error.ts, 21, 3))
>a : Symbol(a, Decl(ts-expect-error.ts, 21, 3))
>a : Symbol(a, Decl(ts-expect-error.ts, 21, 3))
>({ a: true } as const).a : Symbol(a, Decl(ts-expect-error.ts, 39, 3))
>a : Symbol(a, Decl(ts-expect-error.ts, 39, 3))
>a : Symbol(a, Decl(ts-expect-error.ts, 39, 3))
@@ -1,22 +1,50 @@
=== tests/cases/conformance/directives/ts-expect-error.ts ===
// @ts-expect-error additional commenting
var invalidCommentedFancy: number = 'nope';
>invalidCommentedFancy : number
var invalidCommentedFancySingle: number = 'nope';
>invalidCommentedFancySingle : number
>'nope' : "nope"
/*
@ts-expect-error additional commenting */
var invalidCommentedFancyMulti: number = 'nope';
>invalidCommentedFancyMulti : number
>'nope' : "nope"
// @ts-expect-error additional commenting
var validCommentedFancy: string = 'nope';
>validCommentedFancy : string
var validCommentedFancySingle: string = 'nope';
>validCommentedFancySingle : string
>'nope' : "nope"
/* @ts-expect-error additional commenting */
var validCommentedFancyMulti: string = 'nope';
>validCommentedFancyMulti : string
>'nope' : "nope"
// @ts-expect-error
var invalidCommentedPlain: number = 'nope';
>invalidCommentedPlain : number
var invalidCommentedPlainSingle: number = 'nope';
>invalidCommentedPlainSingle : number
>'nope' : "nope"
/*
@ts-expect-error */
var invalidCommentedPlainMulti: number = 'nope';
>invalidCommentedPlainMulti : number
>'nope' : "nope"
// @ts-expect-error
var validCommentedPlain: string = 'nope';
>validCommentedPlain : string
var validCommentedPlainSingle: string = 'nope';
>validCommentedPlainSingle : string
>'nope' : "nope"
/* @ts-expect-error */
var validCommentedPlainMulti1: string = 'nope';
>validCommentedPlainMulti1 : string
>'nope' : "nope"
/*
@ts-expect-error */
var validCommentedPlainMulti2: string = 'nope';
>validCommentedPlainMulti2 : string
>'nope' : "nope"
var invalidPlain: number = 'nope';
@@ -0,0 +1,53 @@
// @filename: a.ts
export const texts: string[] = [];
/**
@ts-ignore */
texts.push(100);
/**
@ts-expect-error */
texts.push(100);
/**
@ts-expect-error */
texts.push("100");
// @filename: b.tsx
// @jsx: react
// @libFiles: react.d.ts,lib.d.ts
import * as React from "react";
export function MyComponent(props: { foo: string }) {
return <div />;
}
let x = (
<div>
{/*
@ts-ignore */}
<MyComponent foo={100} />
{/*@ts-ignore*/}
<MyComponent foo={100} />
{/*
@ts-expect-error */}
<MyComponent foo={100} />
{/*
// @ts-expect-error */}
<MyComponent foo={100} />
{/*
* @ts-expect-error */}
<MyComponent foo={100} />
{/*@ts-expect-error*/}
<MyComponent foo={100} />
{/*
@ts-expect-error */}
<MyComponent foo={"hooray"} />
</div>
);
@@ -1,14 +1,32 @@
// @ts-expect-error additional commenting
var invalidCommentedFancy: number = 'nope';
var invalidCommentedFancySingle: number = 'nope';
/*
@ts-expect-error additional commenting */
var invalidCommentedFancyMulti: number = 'nope';
// @ts-expect-error additional commenting
var validCommentedFancy: string = 'nope';
var validCommentedFancySingle: string = 'nope';
/* @ts-expect-error additional commenting */
var validCommentedFancyMulti: string = 'nope';
// @ts-expect-error
var invalidCommentedPlain: number = 'nope';
var invalidCommentedPlainSingle: number = 'nope';
/*
@ts-expect-error */
var invalidCommentedPlainMulti: number = 'nope';
// @ts-expect-error
var validCommentedPlain: string = 'nope';
var validCommentedPlainSingle: string = 'nope';
/* @ts-expect-error */
var validCommentedPlainMulti1: string = 'nope';
/*
@ts-expect-error */
var validCommentedPlainMulti2: string = 'nope';
var invalidPlain: number = 'nope';