fix: get rid of CRLF (#5494)
parent
b878a54e6a
commit
952bc0cc03
|
@ -1,4 +1 @@
|
|||
# Make sure baseline files have consistent line endings
|
||||
*.txt text eol=lf
|
||||
*.snap text eol=lf
|
||||
*.debug-check text eol=lf
|
||||
* text=auto eol=lf
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
trigger:
|
||||
- master
|
||||
- releases-*
|
||||
- release-*
|
||||
|
||||
variables:
|
||||
AST_COMPARE: true
|
||||
|
@ -31,6 +31,7 @@ jobs:
|
|||
vmImage: vs2017-win2016
|
||||
variables:
|
||||
node_version: 10
|
||||
TEST_CRLF: true
|
||||
steps:
|
||||
- template: .azure-pipelines/dev.yml
|
||||
|
||||
|
|
|
@ -17,13 +17,9 @@ module.exports = {
|
|||
"jest-snapshot-serializer-ansi"
|
||||
],
|
||||
testRegex: "jsfmt\\.spec\\.js$|__tests__/.*\\.js$",
|
||||
testPathIgnorePatterns: ["tests/new_react", "tests/more_react"]
|
||||
.concat(isOldNode ? requiresPrettierInternals : [])
|
||||
.concat(
|
||||
require("os").EOL == "\n"
|
||||
? ["tests_integration/__tests__/eol-crlf.js"]
|
||||
: ["tests_integration/__tests__/eol-lf.js"]
|
||||
),
|
||||
testPathIgnorePatterns: ["tests/new_react", "tests/more_react"].concat(
|
||||
isOldNode ? requiresPrettierInternals : []
|
||||
),
|
||||
collectCoverage: ENABLE_COVERAGE,
|
||||
collectCoverageFrom: ["src/**/*.js", "index.js", "!<rootDir>/node_modules/"],
|
||||
coveragePathIgnorePatterns: [
|
||||
|
|
|
@ -71,8 +71,8 @@
|
|||
"unicode-regex": "2.0.0",
|
||||
"unified": "6.1.6",
|
||||
"vnopts": "1.0.2",
|
||||
"yaml": "1.0.0-rc.8",
|
||||
"yaml-unist-parser": "1.0.0-rc.4"
|
||||
"yaml": "1.0.2",
|
||||
"yaml-unist-parser": "1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "7.1.5",
|
||||
|
|
|
@ -675,7 +675,19 @@ function isWithinParentArrayProperty(path, propertyName) {
|
|||
return parent[propertyName][key] === node;
|
||||
}
|
||||
|
||||
function replaceEndOfLineWith(text, replacement) {
|
||||
const parts = [];
|
||||
for (const part of text.split("\n")) {
|
||||
if (parts.length !== 0) {
|
||||
parts.push(replacement);
|
||||
}
|
||||
parts.push(part);
|
||||
}
|
||||
return parts;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
replaceEndOfLineWith,
|
||||
getStringWidth,
|
||||
getMaxContinuousCount,
|
||||
getPrecedence,
|
||||
|
|
|
@ -110,11 +110,7 @@ function genericPrint(path, options, print) {
|
|||
}
|
||||
case "css-comment": {
|
||||
if (node.raws.content) {
|
||||
return (
|
||||
node.raws.content
|
||||
// there's a bug in the less parser that trailing `\r`s are included in inline comments
|
||||
.replace(/^(\/\/[^]+)\r+$/, "$1")
|
||||
);
|
||||
return node.raws.content;
|
||||
}
|
||||
const text = options.originalText.slice(
|
||||
options.locStart(node),
|
||||
|
|
|
@ -265,7 +265,6 @@ function createParser({
|
|||
allowHtmComponentClosingTags = false
|
||||
} = {}) {
|
||||
return {
|
||||
preprocess: text => text.replace(/\r\n?/g, "\n"),
|
||||
parse: (text, parsers, options) =>
|
||||
_parse(text, options, {
|
||||
recognizeSelfClosing,
|
||||
|
|
|
@ -34,12 +34,11 @@ const {
|
|||
isTextLikeNode,
|
||||
normalizeParts,
|
||||
preferHardlineAsLeadingSpaces,
|
||||
replaceDocNewlines,
|
||||
replaceNewlines,
|
||||
shouldNotPrintClosingTag,
|
||||
shouldPreserveContent,
|
||||
unescapeQuoteEntities
|
||||
} = require("./utils");
|
||||
const { replaceEndOfLineWith } = require("../common/util");
|
||||
const preprocess = require("./preprocess");
|
||||
const assert = require("assert");
|
||||
const { insertPragma } = require("./pragma");
|
||||
|
@ -147,10 +146,7 @@ function embed(path, print, textToDoc, options) {
|
|||
hardline,
|
||||
node.value.trim().length === 0
|
||||
? ""
|
||||
: replaceDocNewlines(
|
||||
textToDoc(node.value, { parser: "yaml" }),
|
||||
literalline
|
||||
),
|
||||
: textToDoc(node.value, { parser: "yaml" }),
|
||||
"---"
|
||||
])
|
||||
);
|
||||
|
@ -287,7 +283,7 @@ function genericPrint(path, options, print) {
|
|||
? node.value.replace(trailingNewlineRegex, "")
|
||||
: node.value;
|
||||
return concat([
|
||||
concat(replaceNewlines(value, literalline)),
|
||||
concat(replaceEndOfLineWith(value, literalline)),
|
||||
hasTrailingNewline ? hardline : ""
|
||||
]);
|
||||
}
|
||||
|
@ -316,7 +312,7 @@ function genericPrint(path, options, print) {
|
|||
return concat([
|
||||
printOpeningTagPrefix(node, options),
|
||||
concat(
|
||||
replaceNewlines(
|
||||
replaceEndOfLineWith(
|
||||
options.originalText.slice(
|
||||
options.locStart(node),
|
||||
options.locEnd(node)
|
||||
|
@ -341,7 +337,7 @@ function genericPrint(path, options, print) {
|
|||
"=",
|
||||
quote,
|
||||
concat(
|
||||
replaceNewlines(
|
||||
replaceEndOfLineWith(
|
||||
quote === '"'
|
||||
? value.replace(/"/g, """)
|
||||
: value.replace(/'/g, "'"),
|
||||
|
@ -354,7 +350,7 @@ function genericPrint(path, options, print) {
|
|||
}
|
||||
case "yaml":
|
||||
case "toml":
|
||||
return node.raw;
|
||||
return concat(replaceEndOfLineWith(node.raw, literalline));
|
||||
default:
|
||||
throw new Error(`Unexpected node type ${node.type}`);
|
||||
}
|
||||
|
@ -473,7 +469,7 @@ function printChildren(path, options, print) {
|
|||
return concat(
|
||||
[].concat(
|
||||
printOpeningTagPrefix(child, options),
|
||||
replaceNewlines(
|
||||
replaceEndOfLineWith(
|
||||
options.originalText.slice(
|
||||
options.locStart(child) +
|
||||
(child.prev &&
|
||||
|
@ -497,7 +493,7 @@ function printChildren(path, options, print) {
|
|||
[].concat(
|
||||
printOpeningTagPrefix(child, options),
|
||||
group(printOpeningTag(childPath, options, print)),
|
||||
replaceNewlines(
|
||||
replaceEndOfLineWith(
|
||||
options.originalText.slice(
|
||||
child.startSourceSpan.end.offset +
|
||||
(child.firstChild &&
|
||||
|
@ -620,7 +616,7 @@ function printOpeningTag(path, options, print) {
|
|||
const attr = attrPath.getValue();
|
||||
return hasPrettierIgnoreAttribute(attr)
|
||||
? concat(
|
||||
replaceNewlines(
|
||||
replaceEndOfLineWith(
|
||||
options.originalText.slice(
|
||||
options.locStart(attr),
|
||||
options.locEnd(attr)
|
||||
|
@ -894,8 +890,8 @@ function printClosingTagEndMarker(node, options) {
|
|||
function getTextValueParts(node, value = node.value) {
|
||||
return node.parent.isWhitespaceSensitive
|
||||
? node.parent.isIndentationSensitive
|
||||
? replaceNewlines(value, literalline)
|
||||
: replaceNewlines(
|
||||
? replaceEndOfLineWith(value, literalline)
|
||||
: replaceEndOfLineWith(
|
||||
dedentString(value.replace(/^\s*?\n|\n\s*?$/g, "")),
|
||||
hardline
|
||||
)
|
||||
|
@ -1037,7 +1033,7 @@ function printEmbeddedAttributeValue(node, originalTextToDoc, options) {
|
|||
const parts = [];
|
||||
value.split(interpolationRegex).forEach((part, index) => {
|
||||
if (index % 2 === 0) {
|
||||
parts.push(concat(replaceNewlines(part, literalline)));
|
||||
parts.push(concat(replaceEndOfLineWith(part, literalline)));
|
||||
} else {
|
||||
try {
|
||||
parts.push(
|
||||
|
@ -1056,7 +1052,11 @@ function printEmbeddedAttributeValue(node, originalTextToDoc, options) {
|
|||
)
|
||||
);
|
||||
} catch (e) {
|
||||
parts.push("{{", concat(replaceNewlines(part, literalline)), "}}");
|
||||
parts.push(
|
||||
"{{",
|
||||
concat(replaceEndOfLineWith(part, literalline)),
|
||||
"}}"
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const {
|
||||
builders: { concat },
|
||||
utils: { mapDoc }
|
||||
} = require("../doc");
|
||||
|
||||
const {
|
||||
CSS_DISPLAY_TAGS,
|
||||
CSS_DISPLAY_DEFAULT,
|
||||
|
@ -263,20 +258,6 @@ function isDanglingSpaceSensitiveNode(node) {
|
|||
);
|
||||
}
|
||||
|
||||
function replaceNewlines(text, replacement) {
|
||||
return text
|
||||
.split(/(\n)/g)
|
||||
.map((data, index) => (index % 2 === 1 ? replacement : data));
|
||||
}
|
||||
|
||||
function replaceDocNewlines(doc, replacement) {
|
||||
return mapDoc(doc, currentDoc =>
|
||||
typeof currentDoc === "string" && currentDoc.includes("\n")
|
||||
? concat(replaceNewlines(currentDoc, replacement))
|
||||
: currentDoc
|
||||
);
|
||||
}
|
||||
|
||||
function forceNextEmptyLine(node) {
|
||||
return (
|
||||
isFrontMatterNode(node) ||
|
||||
|
@ -645,8 +626,6 @@ module.exports = {
|
|||
normalizeParts,
|
||||
preferHardlineAsLeadingSpaces,
|
||||
preferHardlineAsTrailingSpaces,
|
||||
replaceDocNewlines,
|
||||
replaceNewlines,
|
||||
shouldNotPrintClosingTag,
|
||||
shouldPreserveContent,
|
||||
unescapeQuoteEntities
|
||||
|
|
|
@ -2395,7 +2395,10 @@ function printPathNoParens(path, options, print, args) {
|
|||
"${" +
|
||||
printDocToString(
|
||||
doc,
|
||||
Object.assign({}, options, { printWidth: Infinity })
|
||||
Object.assign({}, options, {
|
||||
printWidth: Infinity,
|
||||
endOfLine: "lf"
|
||||
})
|
||||
).formatted +
|
||||
"}"
|
||||
);
|
||||
|
|
|
@ -42,7 +42,7 @@ function embed(path, print, textToDoc, options) {
|
|||
concat([
|
||||
"---",
|
||||
hardline,
|
||||
node.value.trim()
|
||||
node.value && node.value.trim()
|
||||
? replaceNewlinesWithLiterallines(
|
||||
textToDoc(node.value, { parser: "yaml" })
|
||||
)
|
||||
|
|
|
@ -9,7 +9,7 @@ function startWithPragma(text) {
|
|||
const regex = new RegExp(
|
||||
[
|
||||
`<!--\\s*${pragma}\\s*-->`,
|
||||
`<!--.*\n[\\s\\S]*(^|\n)[^\\S\n]*${pragma}[^\\S\n]*($|\n)[\\s\\S]*\n.*-->`
|
||||
`<!--.*\r?\n[\\s\\S]*(^|\n)[^\\S\n]*${pragma}[^\\S\n]*($|\n)[\\s\\S]*\n.*-->`
|
||||
].join("|"),
|
||||
"m"
|
||||
);
|
||||
|
|
|
@ -27,6 +27,7 @@ const {
|
|||
splitText,
|
||||
punctuationPattern
|
||||
} = require("./utils");
|
||||
const { replaceEndOfLineWith } = require("../common/util");
|
||||
|
||||
const TRAILING_HARDLINE_NODES = ["importExport"];
|
||||
|
||||
|
@ -209,7 +210,10 @@ function genericPrint(path, options, print) {
|
|||
const alignment = " ".repeat(4);
|
||||
return align(
|
||||
alignment,
|
||||
concat([alignment, replaceNewlinesWith(node.value, hardline)])
|
||||
concat([
|
||||
alignment,
|
||||
concat(replaceEndOfLineWith(node.value, hardline))
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -225,9 +229,11 @@ function genericPrint(path, options, print) {
|
|||
style,
|
||||
node.lang || "",
|
||||
hardline,
|
||||
replaceNewlinesWith(
|
||||
getFencedCodeBlockValue(node, options.originalText),
|
||||
hardline
|
||||
concat(
|
||||
replaceEndOfLineWith(
|
||||
getFencedCodeBlockValue(node, options.originalText),
|
||||
hardline
|
||||
)
|
||||
),
|
||||
hardline,
|
||||
style
|
||||
|
@ -247,9 +253,11 @@ function genericPrint(path, options, print) {
|
|||
? node.value.trimRight()
|
||||
: node.value;
|
||||
const isHtmlComment = /^<!--[\s\S]*-->$/.test(value);
|
||||
return replaceNewlinesWith(
|
||||
value,
|
||||
isHtmlComment ? hardline : markAsRoot(literalline)
|
||||
return concat(
|
||||
replaceEndOfLineWith(
|
||||
value,
|
||||
isHtmlComment ? hardline : markAsRoot(literalline)
|
||||
)
|
||||
);
|
||||
}
|
||||
case "list": {
|
||||
|
@ -394,7 +402,7 @@ function genericPrint(path, options, print) {
|
|||
? concat([" ", markAsRoot(literalline)])
|
||||
: concat(["\\", hardline]);
|
||||
case "liquidNode":
|
||||
return replaceNewlinesWith(node.value, hardline);
|
||||
return concat(replaceEndOfLineWith(node.value, hardline));
|
||||
// MDX
|
||||
case "importExport":
|
||||
case "jsx":
|
||||
|
@ -404,7 +412,10 @@ function genericPrint(path, options, print) {
|
|||
"$$",
|
||||
hardline,
|
||||
node.value
|
||||
? concat([replaceNewlinesWith(node.value, hardline), hardline])
|
||||
? concat([
|
||||
concat(replaceEndOfLineWith(node.value, hardline)),
|
||||
hardline
|
||||
])
|
||||
: "",
|
||||
"$$"
|
||||
]);
|
||||
|
@ -467,10 +478,6 @@ function getNthListSiblingIndex(node, parentNode) {
|
|||
);
|
||||
}
|
||||
|
||||
function replaceNewlinesWith(str, doc) {
|
||||
return join(doc, str.replace(/\r\n?/g, "\n").split("\n"));
|
||||
}
|
||||
|
||||
function getNthSiblingIndex(node, parentNode, condition) {
|
||||
condition = condition || (() => true);
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ function getFencedCodeBlockValue(node, originalText) {
|
|||
const leadingSpaceCount = text.match(/^\s*/)[0].length;
|
||||
const replaceRegex = new RegExp(`^\\s{0,${leadingSpaceCount}}`);
|
||||
|
||||
const lineContents = text.replace(/\r\n?/g, "\n").split("\n");
|
||||
const lineContents = text.split("\n");
|
||||
|
||||
const markerStyle = text[leadingSpaceCount]; // ` or ~
|
||||
const marker = text
|
||||
|
|
|
@ -29,11 +29,7 @@ const parser = {
|
|||
parse,
|
||||
hasPragma,
|
||||
locStart: node => node.position.start.offset,
|
||||
locEnd: node => node.position.end.offset,
|
||||
|
||||
// workaround for https://github.com/eemeli/yaml/issues/20
|
||||
preprocess: text =>
|
||||
text.indexOf("\r") === -1 ? text : text.replace(/\r\n?/g, "\n")
|
||||
locEnd: node => node.position.end.offset
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
|
|
@ -38,6 +38,7 @@ const {
|
|||
markAsRoot,
|
||||
softline
|
||||
} = docBuilders;
|
||||
const { replaceEndOfLineWith } = require("../common/util");
|
||||
|
||||
function preprocess(ast) {
|
||||
return mapNode(ast, defineShortcuts);
|
||||
|
@ -104,9 +105,14 @@ function genericPrint(path, options, print) {
|
|||
])
|
||||
: "",
|
||||
hasPrettierIgnore(path)
|
||||
? options.originalText.slice(
|
||||
node.position.start.offset,
|
||||
node.position.end.offset
|
||||
? concat(
|
||||
replaceEndOfLineWith(
|
||||
options.originalText.slice(
|
||||
node.position.start.offset,
|
||||
node.position.end.offset
|
||||
),
|
||||
literalline
|
||||
)
|
||||
)
|
||||
: group(_print(node, parentNode, path, options, print)),
|
||||
hasTrailingComment(node) && !isNode(node, ["document", "documentHead"])
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
function getLast(array) {
|
||||
return array[array.length - 1];
|
||||
}
|
||||
const { getLast } = require("../common/util");
|
||||
|
||||
function getAncestorCount(path, filter) {
|
||||
let counter = 0;
|
||||
|
|
138
src/main/core.js
138
src/main/core.js
|
@ -14,6 +14,7 @@ const {
|
|||
const rangeUtil = require("./range-util");
|
||||
const privateUtil = require("../common/util");
|
||||
const {
|
||||
utils: { mapDoc },
|
||||
printer: { printDocToString },
|
||||
debug: { printDocToDebug }
|
||||
} = require("../doc");
|
||||
|
@ -21,6 +22,11 @@ const {
|
|||
const UTF8BOM = 0xfeff;
|
||||
|
||||
const CURSOR = Symbol("cursor");
|
||||
const PLACEHOLDERS = {
|
||||
cursorOffset: "<<<PRETTIER_CURSOR>>>",
|
||||
rangeStart: "<<<PRETTIER_RANGE_START>>>",
|
||||
rangeEnd: "<<<PRETTIER_RANGE_END>>>"
|
||||
};
|
||||
|
||||
function ensureAllCommentsPrinted(astComments) {
|
||||
if (!astComments) {
|
||||
|
@ -67,8 +73,6 @@ function coreFormat(text, opts, addAlignmentSize) {
|
|||
|
||||
const parsed = parser.parse(text, opts);
|
||||
const ast = parsed.ast;
|
||||
|
||||
const originalText = text;
|
||||
text = parsed.text;
|
||||
|
||||
if (opts.cursorOffset >= 0) {
|
||||
|
@ -80,11 +84,18 @@ function coreFormat(text, opts, addAlignmentSize) {
|
|||
|
||||
const astComments = attachComments(text, ast, opts);
|
||||
const doc = printAstToDoc(ast, opts, addAlignmentSize);
|
||||
if (opts.endOfLine === "auto") {
|
||||
opts.endOfLine = guessEndOfLine(originalText);
|
||||
}
|
||||
|
||||
const result = printDocToString(doc, opts);
|
||||
const eol = convertEndOfLineToChars(opts.endOfLine);
|
||||
const result = printDocToString(
|
||||
opts.endOfLine === "lf"
|
||||
? doc
|
||||
: mapDoc(doc, currentDoc =>
|
||||
typeof currentDoc === "string" && currentDoc.indexOf("\n") !== -1
|
||||
? currentDoc.replace(/\n/g, eol)
|
||||
: currentDoc
|
||||
),
|
||||
opts
|
||||
);
|
||||
|
||||
ensureAllCommentsPrinted(astComments);
|
||||
// Remove extra leading indentation as well as the added indentation after last newline
|
||||
|
@ -212,8 +223,8 @@ function formatRange(text, opts) {
|
|||
// Since the range contracts to avoid trailing whitespace,
|
||||
// we need to remove the newline that was inserted by the `format` call.
|
||||
const rangeTrimmed = rangeResult.formatted.trimRight();
|
||||
const formatted =
|
||||
text.slice(0, rangeStart) + rangeTrimmed + text.slice(rangeEnd);
|
||||
const rangeLeft = text.slice(0, rangeStart);
|
||||
const rangeRight = text.slice(rangeEnd);
|
||||
|
||||
let cursorOffset = opts.cursorOffset;
|
||||
if (opts.cursorOffset >= rangeEnd) {
|
||||
|
@ -226,6 +237,44 @@ function formatRange(text, opts) {
|
|||
}
|
||||
// keep the cursor as it was if it was before the start of the range
|
||||
|
||||
let formatted;
|
||||
if (opts.endOfLine === "lf") {
|
||||
formatted = rangeLeft + rangeTrimmed + rangeRight;
|
||||
} else {
|
||||
const eol = convertEndOfLineToChars(opts.endOfLine);
|
||||
if (cursorOffset >= 0) {
|
||||
const parts = [rangeLeft, rangeTrimmed, rangeRight];
|
||||
let partIndex = 0;
|
||||
let partOffset = cursorOffset;
|
||||
while (partIndex < parts.length) {
|
||||
const part = parts[partIndex];
|
||||
if (partOffset < part.length) {
|
||||
parts[partIndex] =
|
||||
parts[partIndex].slice(0, partOffset) +
|
||||
PLACEHOLDERS.cursorOffset +
|
||||
parts[partIndex].slice(partOffset);
|
||||
break;
|
||||
}
|
||||
partIndex++;
|
||||
partOffset -= part.length;
|
||||
}
|
||||
const [newRangeLeft, newRangeTrimmed, newRangeRight] = parts;
|
||||
formatted = (
|
||||
newRangeLeft.replace(/\n/g, eol) +
|
||||
newRangeTrimmed +
|
||||
newRangeRight.replace(/\n/g, eol)
|
||||
).replace(PLACEHOLDERS.cursorOffset, (_, index) => {
|
||||
cursorOffset = index;
|
||||
return "";
|
||||
});
|
||||
} else {
|
||||
formatted =
|
||||
rangeLeft.replace(/\n/g, eol) +
|
||||
rangeTrimmed +
|
||||
rangeRight.replace(/\n/g, eol);
|
||||
}
|
||||
}
|
||||
|
||||
return { formatted, cursorOffset };
|
||||
}
|
||||
|
||||
|
@ -236,23 +285,83 @@ function format(text, opts) {
|
|||
return { formatted: text };
|
||||
}
|
||||
|
||||
if (opts.rangeStart > 0 || opts.rangeEnd < text.length) {
|
||||
return formatRange(text, opts);
|
||||
if (opts.endOfLine === "auto") {
|
||||
opts.endOfLine = guessEndOfLine(text);
|
||||
}
|
||||
|
||||
const hasCursor = opts.cursorOffset >= 0;
|
||||
const hasRangeStart = opts.rangeStart > 0;
|
||||
const hasRangeEnd = opts.rangeEnd < text.length;
|
||||
|
||||
// get rid of CR/CRLF parsing
|
||||
if (text.indexOf("\r") !== -1) {
|
||||
const offsetKeys = [
|
||||
hasCursor && "cursorOffset",
|
||||
hasRangeStart && "rangeStart",
|
||||
hasRangeEnd && "rangeEnd"
|
||||
]
|
||||
.filter(Boolean)
|
||||
.sort((aKey, bKey) => opts[aKey] - opts[bKey]);
|
||||
|
||||
for (let i = offsetKeys.length - 1; i >= 0; i--) {
|
||||
const key = offsetKeys[i];
|
||||
text =
|
||||
text.slice(0, opts[key]) + PLACEHOLDERS[key] + text.slice(opts[key]);
|
||||
}
|
||||
|
||||
text = text.replace(/\r\n?/g, "\n");
|
||||
|
||||
for (let i = 0; i < offsetKeys.length; i++) {
|
||||
const key = offsetKeys[i];
|
||||
text = text.replace(PLACEHOLDERS[key], (_, index) => {
|
||||
opts[key] = index;
|
||||
return "";
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const hasUnicodeBOM = text.charCodeAt(0) === UTF8BOM;
|
||||
if (hasUnicodeBOM) {
|
||||
text = text.substring(1);
|
||||
if (hasCursor) {
|
||||
opts.cursorOffset++;
|
||||
}
|
||||
if (hasRangeStart) {
|
||||
opts.rangeStart++;
|
||||
}
|
||||
if (hasRangeEnd) {
|
||||
opts.rangeEnd++;
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.insertPragma && opts.printer.insertPragma && !hasPragma) {
|
||||
text = opts.printer.insertPragma(text);
|
||||
if (!hasCursor) {
|
||||
opts.cursorOffset = -1;
|
||||
}
|
||||
if (opts.rangeStart < 0) {
|
||||
opts.rangeStart = 0;
|
||||
}
|
||||
if (opts.rangeEnd > text.length) {
|
||||
opts.rangeEnd = text.length;
|
||||
}
|
||||
|
||||
const result = coreFormat(text, opts);
|
||||
const result =
|
||||
hasRangeStart || hasRangeEnd
|
||||
? formatRange(text, opts)
|
||||
: coreFormat(
|
||||
opts.insertPragma && opts.printer.insertPragma && !hasPragma
|
||||
? opts.printer.insertPragma(text)
|
||||
: text,
|
||||
opts
|
||||
);
|
||||
|
||||
if (hasUnicodeBOM) {
|
||||
result.formatted = String.fromCharCode(UTF8BOM) + result.formatted;
|
||||
|
||||
if (hasCursor) {
|
||||
result.cursorOffset++;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -264,6 +373,9 @@ module.exports = {
|
|||
|
||||
parse(text, opts, massage) {
|
||||
opts = normalizeOptions(opts);
|
||||
if (text.indexOf("\r") !== -1) {
|
||||
text = text.replace(/\r\n?/g, "\n");
|
||||
}
|
||||
const parsed = parser.parse(text, opts);
|
||||
if (massage) {
|
||||
parsed.ast = massageAST(parsed.ast, opts);
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
<div
|
||||
// comment
|
||||
>
|
||||
{foo}
|
||||
</div>;
|
||||
|
||||
<div
|
||||
// comment
|
||||
attr="foo"
|
||||
>
|
||||
{foo}
|
||||
</div>;
|
||||
|
||||
<div
|
||||
attr="foo" // comment
|
||||
>
|
||||
{foo}
|
||||
</div>;
|
||||
|
||||
<div
|
||||
attr="foo"
|
||||
// comment
|
||||
>
|
||||
{foo}
|
||||
</div>;
|
||||
|
||||
<br // comment
|
||||
/>;
|
||||
<div
|
||||
// comment
|
||||
>
|
||||
{foo}
|
||||
</div>;
|
||||
|
||||
<div
|
||||
// comment
|
||||
attr="foo"
|
||||
>
|
||||
{foo}
|
||||
</div>;
|
||||
|
||||
<div
|
||||
attr="foo" // comment
|
||||
>
|
||||
{foo}
|
||||
</div>;
|
||||
|
||||
<div
|
||||
attr="foo"
|
||||
// comment
|
||||
>
|
||||
{foo}
|
||||
</div>;
|
||||
|
||||
<br // comment
|
||||
/>;
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
import {observable} from "mobx";
|
||||
|
||||
@observer class OrderLine {
|
||||
@observable price:number = 0;
|
||||
@observable amount:number = 1;
|
||||
|
||||
constructor(price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
@computed get total() {
|
||||
return this.price * this.amount;
|
||||
}
|
||||
|
||||
@action.bound setPrice(price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
@computed
|
||||
get total() {
|
||||
return this.price * this.amount;
|
||||
}
|
||||
|
||||
@action.bound
|
||||
setPrice(price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
@computed @computed @computed @computed @computed @computed @computed get total() {
|
||||
return this.price * this.amount;
|
||||
}
|
||||
|
||||
@action handleDecrease = (event: React.ChangeEvent<HTMLInputElement>) => this.count--;
|
||||
|
||||
@action handleSomething = (event: React.ChangeEvent<HTMLInputElement>) => doSomething();
|
||||
}
|
||||
import {observable} from "mobx";
|
||||
|
||||
@observer class OrderLine {
|
||||
@observable price:number = 0;
|
||||
@observable amount:number = 1;
|
||||
|
||||
constructor(price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
@computed get total() {
|
||||
return this.price * this.amount;
|
||||
}
|
||||
|
||||
@action.bound setPrice(price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
@computed
|
||||
get total() {
|
||||
return this.price * this.amount;
|
||||
}
|
||||
|
||||
@action.bound
|
||||
setPrice(price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
@computed @computed @computed @computed @computed @computed @computed get total() {
|
||||
return this.price * this.amount;
|
||||
}
|
||||
|
||||
@action handleDecrease = (event: React.ChangeEvent<HTMLInputElement>) => this.count--;
|
||||
|
||||
@action handleSomething = (event: React.ChangeEvent<HTMLInputElement>) => doSomething();
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
'meaningfully escaped alphabetical characters \n \r \v \t \b \f \u2713 \x61'
|
||||
'escaped newline \
|
||||
'
|
||||
'escaped carriage return \
|
||||
'escaped carriage return \
|
||||
'
|
||||
'escaped \u2028 \
'
|
||||
'escaped \u2029 \
'
|
||||
|
|
|
@ -1,145 +1,58 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`usingCrlf.js 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babylon"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
function f() {
|
||||
console.log("testing line endings");
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
function f() {
|
||||
console.log("testing line endings");
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`usingCrlf.js 2`] = `
|
||||
exports[`example.js 1`] = `
|
||||
====================================options=====================================
|
||||
endOfLine: "cr"
|
||||
parsers: ["babylon"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
function f() {
|
||||
console.log("testing line endings");
|
||||
}
|
||||
function f() {<LF>
|
||||
console.log("testing line endings");<LF>
|
||||
}<LF>
|
||||
|
||||
=====================================output=====================================
|
||||
function f() {/*CR*/ console.log("testing line endings");/*CR*/}/*CR*/
|
||||
function f() {<CR>
|
||||
console.log("testing line endings");<CR>
|
||||
}<CR>
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`usingCrlf.js 3`] = `
|
||||
exports[`example.js 2`] = `
|
||||
====================================options=====================================
|
||||
endOfLine: "crlf"
|
||||
parsers: ["babylon"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
function f() {
|
||||
console.log("testing line endings");
|
||||
}
|
||||
function f() {<LF>
|
||||
console.log("testing line endings");<LF>
|
||||
}<LF>
|
||||
|
||||
=====================================output=====================================
|
||||
function f() {/*CR*/
|
||||
console.log("testing line endings");/*CR*/
|
||||
}/*CR*/
|
||||
function f() {<CRLF>
|
||||
console.log("testing line endings");<CRLF>
|
||||
}<CRLF>
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`usingCrlf.js 4`] = `
|
||||
exports[`example.js 3`] = `
|
||||
====================================options=====================================
|
||||
endOfLine: "lf"
|
||||
parsers: ["babylon"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
function f() {
|
||||
console.log("testing line endings");
|
||||
}
|
||||
function f() {<LF>
|
||||
console.log("testing line endings");<LF>
|
||||
}<LF>
|
||||
|
||||
=====================================output=====================================
|
||||
function f() {
|
||||
console.log("testing line endings");
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`usingLf.js 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babylon"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
function f() {
|
||||
console.log("testing line endings");
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
function f() {
|
||||
console.log("testing line endings");
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`usingLf.js 2`] = `
|
||||
====================================options=====================================
|
||||
endOfLine: "cr"
|
||||
parsers: ["babylon"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
function f() {
|
||||
console.log("testing line endings");
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
function f() {/*CR*/ console.log("testing line endings");/*CR*/}/*CR*/
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`usingLf.js 3`] = `
|
||||
====================================options=====================================
|
||||
endOfLine: "crlf"
|
||||
parsers: ["babylon"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
function f() {
|
||||
console.log("testing line endings");
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
function f() {/*CR*/
|
||||
console.log("testing line endings");/*CR*/
|
||||
}/*CR*/
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`usingLf.js 4`] = `
|
||||
====================================options=====================================
|
||||
endOfLine: "lf"
|
||||
parsers: ["babylon"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
function f() {
|
||||
console.log("testing line endings");
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
function f() {
|
||||
console.log("testing line endings");
|
||||
}
|
||||
function f() {<LF>
|
||||
console.log("testing line endings");<LF>
|
||||
}<LF>
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
run_spec(__dirname, ["babylon"]);
|
||||
run_spec(__dirname, ["babylon"], { endOfLine: "cr" });
|
||||
run_spec(__dirname, ["babylon"], { endOfLine: "crlf" });
|
||||
run_spec(__dirname, ["babylon"], { endOfLine: "lf" });
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
function f() {
|
||||
console.log("testing line endings");
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`usingCrlf.css 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["css"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
.foo {
|
||||
margin: 42px;
|
||||
}
|
||||
=====================================output=====================================
|
||||
.foo {
|
||||
margin: 42px;
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`usingCrlf.css 2`] = `
|
||||
====================================options=====================================
|
||||
endOfLine: "cr"
|
||||
parsers: ["css"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
.foo {
|
||||
margin: 42px;
|
||||
}
|
||||
=====================================output=====================================
|
||||
.foo {/*CR*/ margin: 42px;/*CR*/}/*CR*/
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`usingCrlf.css 3`] = `
|
||||
====================================options=====================================
|
||||
endOfLine: "crlf"
|
||||
parsers: ["css"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
.foo {
|
||||
margin: 42px;
|
||||
}
|
||||
=====================================output=====================================
|
||||
.foo {/*CR*/
|
||||
margin: 42px;/*CR*/
|
||||
}/*CR*/
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`usingCrlf.css 4`] = `
|
||||
====================================options=====================================
|
||||
endOfLine: "lf"
|
||||
parsers: ["css"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
.foo {
|
||||
margin: 42px;
|
||||
}
|
||||
=====================================output=====================================
|
||||
.foo {
|
||||
margin: 42px;
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`usingLf.css 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["css"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
.foo {
|
||||
margin: 42px;
|
||||
}
|
||||
=====================================output=====================================
|
||||
.foo {
|
||||
margin: 42px;
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`usingLf.css 2`] = `
|
||||
====================================options=====================================
|
||||
endOfLine: "cr"
|
||||
parsers: ["css"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
.foo {
|
||||
margin: 42px;
|
||||
}
|
||||
=====================================output=====================================
|
||||
.foo {/*CR*/ margin: 42px;/*CR*/}/*CR*/
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`usingLf.css 3`] = `
|
||||
====================================options=====================================
|
||||
endOfLine: "crlf"
|
||||
parsers: ["css"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
.foo {
|
||||
margin: 42px;
|
||||
}
|
||||
=====================================output=====================================
|
||||
.foo {/*CR*/
|
||||
margin: 42px;/*CR*/
|
||||
}/*CR*/
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`usingLf.css 4`] = `
|
||||
====================================options=====================================
|
||||
endOfLine: "lf"
|
||||
parsers: ["css"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
.foo {
|
||||
margin: 42px;
|
||||
}
|
||||
=====================================output=====================================
|
||||
.foo {
|
||||
margin: 42px;
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
|
@ -1,4 +0,0 @@
|
|||
run_spec(__dirname, ["css"]);
|
||||
run_spec(__dirname, ["css"], { endOfLine: "cr" });
|
||||
run_spec(__dirname, ["css"], { endOfLine: "crlf" });
|
||||
run_spec(__dirname, ["css"], { endOfLine: "lf" });
|
|
@ -1,3 +0,0 @@
|
|||
.foo {
|
||||
margin: 42px;
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
.foo {
|
||||
margin: 42px;
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`usingCrlf.md 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["markdown"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
# Markdown file
|
||||
|
||||
testing line endings
|
||||
=====================================output=====================================
|
||||
# Markdown file
|
||||
|
||||
testing line endings
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`usingCrlf.md 2`] = `
|
||||
====================================options=====================================
|
||||
endOfLine: "cr"
|
||||
parsers: ["markdown"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
# Markdown file
|
||||
|
||||
testing line endings
|
||||
=====================================output=====================================
|
||||
# Markdown file/*CR*//*CR*/testing line endings/*CR*/
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`usingCrlf.md 3`] = `
|
||||
====================================options=====================================
|
||||
endOfLine: "crlf"
|
||||
parsers: ["markdown"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
# Markdown file
|
||||
|
||||
testing line endings
|
||||
=====================================output=====================================
|
||||
# Markdown file/*CR*/
|
||||
/*CR*/
|
||||
testing line endings/*CR*/
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`usingCrlf.md 4`] = `
|
||||
====================================options=====================================
|
||||
endOfLine: "lf"
|
||||
parsers: ["markdown"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
# Markdown file
|
||||
|
||||
testing line endings
|
||||
=====================================output=====================================
|
||||
# Markdown file
|
||||
|
||||
testing line endings
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`usingLf.md 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["markdown"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
# Markdown file
|
||||
|
||||
testing line endings
|
||||
=====================================output=====================================
|
||||
# Markdown file
|
||||
|
||||
testing line endings
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`usingLf.md 2`] = `
|
||||
====================================options=====================================
|
||||
endOfLine: "cr"
|
||||
parsers: ["markdown"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
# Markdown file
|
||||
|
||||
testing line endings
|
||||
=====================================output=====================================
|
||||
# Markdown file/*CR*//*CR*/testing line endings/*CR*/
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`usingLf.md 3`] = `
|
||||
====================================options=====================================
|
||||
endOfLine: "crlf"
|
||||
parsers: ["markdown"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
# Markdown file
|
||||
|
||||
testing line endings
|
||||
=====================================output=====================================
|
||||
# Markdown file/*CR*/
|
||||
/*CR*/
|
||||
testing line endings/*CR*/
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`usingLf.md 4`] = `
|
||||
====================================options=====================================
|
||||
endOfLine: "lf"
|
||||
parsers: ["markdown"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
# Markdown file
|
||||
|
||||
testing line endings
|
||||
=====================================output=====================================
|
||||
# Markdown file
|
||||
|
||||
testing line endings
|
||||
|
||||
================================================================================
|
||||
`;
|
|
@ -1,4 +0,0 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { endOfLine: "cr" });
|
||||
run_spec(__dirname, ["markdown"], { endOfLine: "crlf" });
|
||||
run_spec(__dirname, ["markdown"], { endOfLine: "lf" });
|
|
@ -1,3 +0,0 @@
|
|||
# Markdown file
|
||||
|
||||
testing line endings
|
|
@ -1,3 +0,0 @@
|
|||
# Markdown file
|
||||
|
||||
testing line endings
|
|
@ -1,6 +1,6 @@
|
|||
// @flow
|
||||
// Example found at
|
||||
// https://github.com/sebmarkbage/art/blob/51ffce8164a555d652843241c2fdda52e186cbbd/parsers/svg/text.js#L137
|
||||
const evil_regex_as_a_string = "/[\s<>]*$/";
|
||||
|
||||
const error: string = 123; // Should be an error, but can't lex this file
|
||||
// @flow
|
||||
// Example found at
|
||||
// https://github.com/sebmarkbage/art/blob/51ffce8164a555d652843241c2fdda52e186cbbd/parsers/svg/text.js#L137
|
||||
const evil_regex_as_a_string = "/[\s<>]*$/";
|
||||
|
||||
const error: string = 123; // Should be an error, but can't lex this file
|
||||
|
|
|
@ -1,66 +1,66 @@
|
|||
export interface Environment1 extends GenericEnvironment<
|
||||
SomeType,
|
||||
AnotherType,
|
||||
YetAnotherType,
|
||||
> {
|
||||
m(): void;
|
||||
};
|
||||
export class Environment2 extends GenericEnvironment<
|
||||
SomeType,
|
||||
AnotherType,
|
||||
YetAnotherType,
|
||||
DifferentType1,
|
||||
DifferentType2,
|
||||
DifferentType3,
|
||||
DifferentType4,
|
||||
> {
|
||||
m() {};
|
||||
};
|
||||
|
||||
// Declare Interface Break
|
||||
declare interface ExtendsOne extends ASingleInterface {
|
||||
x: string;
|
||||
}
|
||||
|
||||
declare interface ExtendsLarge extends ASingleInterfaceWithAReallyReallyReallyReallyLongName {
|
||||
x: string;
|
||||
}
|
||||
|
||||
declare interface ExtendsMany extends Interface1, Interface2, Interface3, Interface4, Interface5, Interface6, Interface7 {
|
||||
x: string;
|
||||
}
|
||||
|
||||
// Interface declaration break
|
||||
interface ExtendsOne extends ASingleInterface {
|
||||
x: string;
|
||||
}
|
||||
|
||||
interface ExtendsLarge extends ASingleInterfaceWithAReallyReallyReallyReallyLongName {
|
||||
x: string;
|
||||
}
|
||||
|
||||
interface ExtendsMany extends Interface1, Interface2, Interface3, Interface4, Interface5, Interface6, Interface7 {
|
||||
s: string;
|
||||
}
|
||||
|
||||
// Generic Types
|
||||
interface ExtendsOne extends ASingleInterface<string> {
|
||||
x: string;
|
||||
}
|
||||
|
||||
interface ExtendsLarge extends ASingleInterfaceWithAReallyReallyReallyReallyLongName<string> {
|
||||
x: string;
|
||||
}
|
||||
|
||||
interface ExtendsMany
|
||||
extends ASingleGenericInterface<Interface1, Interface2, Interface3, Interface4, Interface5, Interface6, Interface7> {
|
||||
x: string;
|
||||
}
|
||||
|
||||
interface ExtendsManyWithGenerics
|
||||
extends InterfaceOne, InterfaceTwo, ASingleGenericInterface<Interface1, Interface2, Interface3, Interface4, Interface5, Interface6, Interface7>, InterfaceThree {
|
||||
|
||||
x: string;
|
||||
}
|
||||
|
||||
export interface ExtendsLongOneWithGenerics extends Bar< SomeLongTypeSomeLongTypeSomeLongTypeSomeLongType, ToBreakLineToBreakLineToBreakLine> {}
|
||||
export interface Environment1 extends GenericEnvironment<
|
||||
SomeType,
|
||||
AnotherType,
|
||||
YetAnotherType,
|
||||
> {
|
||||
m(): void;
|
||||
};
|
||||
export class Environment2 extends GenericEnvironment<
|
||||
SomeType,
|
||||
AnotherType,
|
||||
YetAnotherType,
|
||||
DifferentType1,
|
||||
DifferentType2,
|
||||
DifferentType3,
|
||||
DifferentType4,
|
||||
> {
|
||||
m() {};
|
||||
};
|
||||
|
||||
// Declare Interface Break
|
||||
declare interface ExtendsOne extends ASingleInterface {
|
||||
x: string;
|
||||
}
|
||||
|
||||
declare interface ExtendsLarge extends ASingleInterfaceWithAReallyReallyReallyReallyLongName {
|
||||
x: string;
|
||||
}
|
||||
|
||||
declare interface ExtendsMany extends Interface1, Interface2, Interface3, Interface4, Interface5, Interface6, Interface7 {
|
||||
x: string;
|
||||
}
|
||||
|
||||
// Interface declaration break
|
||||
interface ExtendsOne extends ASingleInterface {
|
||||
x: string;
|
||||
}
|
||||
|
||||
interface ExtendsLarge extends ASingleInterfaceWithAReallyReallyReallyReallyLongName {
|
||||
x: string;
|
||||
}
|
||||
|
||||
interface ExtendsMany extends Interface1, Interface2, Interface3, Interface4, Interface5, Interface6, Interface7 {
|
||||
s: string;
|
||||
}
|
||||
|
||||
// Generic Types
|
||||
interface ExtendsOne extends ASingleInterface<string> {
|
||||
x: string;
|
||||
}
|
||||
|
||||
interface ExtendsLarge extends ASingleInterfaceWithAReallyReallyReallyReallyLongName<string> {
|
||||
x: string;
|
||||
}
|
||||
|
||||
interface ExtendsMany
|
||||
extends ASingleGenericInterface<Interface1, Interface2, Interface3, Interface4, Interface5, Interface6, Interface7> {
|
||||
x: string;
|
||||
}
|
||||
|
||||
interface ExtendsManyWithGenerics
|
||||
extends InterfaceOne, InterfaceTwo, ASingleGenericInterface<Interface1, Interface2, Interface3, Interface4, Interface5, Interface6, Interface7>, InterfaceThree {
|
||||
|
||||
x: string;
|
||||
}
|
||||
|
||||
export interface ExtendsLongOneWithGenerics extends Bar< SomeLongTypeSomeLongTypeSomeLongTypeSomeLongType, ToBreakLineToBreakLineToBreakLine> {}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<div>
|
||||
Text
|
||||
<div>
|
||||
Text
|
||||
</div>
|
||||
|
|
|
@ -1,131 +1,131 @@
|
|||
<View
|
||||
style={
|
||||
{
|
||||
someVeryLongStyle1: "true",
|
||||
someVeryLongStyle2: "true",
|
||||
someVeryLongStyle3: "true",
|
||||
someVeryLongStyle4: "true"
|
||||
}
|
||||
}
|
||||
/>;
|
||||
|
||||
<View
|
||||
style={
|
||||
[
|
||||
{
|
||||
someVeryLongStyle1: "true",
|
||||
someVeryLongStyle2: "true",
|
||||
someVeryLongStyle3: "true",
|
||||
someVeryLongStyle4: "true"
|
||||
}
|
||||
]
|
||||
}
|
||||
/>;
|
||||
|
||||
<Something>
|
||||
{() => (
|
||||
<SomethingElse>
|
||||
<span />
|
||||
</SomethingElse>
|
||||
)}
|
||||
</Something>;
|
||||
|
||||
<Something>
|
||||
{items.map(item => (
|
||||
<SomethingElse>
|
||||
<span />
|
||||
</SomethingElse>
|
||||
))}
|
||||
</Something>;
|
||||
|
||||
<Something>
|
||||
{function() {
|
||||
return (
|
||||
<SomethingElse>
|
||||
<span />
|
||||
</SomethingElse>
|
||||
);
|
||||
}}
|
||||
</Something>;
|
||||
|
||||
<RadioListItem
|
||||
key={option}
|
||||
imageSource={this.props.veryBigItemImageSourceFunc &&
|
||||
this.props.veryBigItemImageSourceFunc(option)}
|
||||
imageSize={this.props.veryBigItemImageSize}
|
||||
imageView={this.props.veryBigItemImageViewFunc &&
|
||||
this.props.veryBigItemImageViewFunc(option)}
|
||||
heading={this.props.displayTextFunc(option)}
|
||||
value={option}
|
||||
/>;
|
||||
|
||||
<ParentComponent prop={
|
||||
<Child>
|
||||
test
|
||||
</Child>
|
||||
}/>;
|
||||
|
||||
<BookingIntroPanel
|
||||
prop="long_string_make_to_force_break"
|
||||
logClick={data => doLogClick("short", "short", data)}
|
||||
/>;
|
||||
|
||||
<BookingIntroPanel
|
||||
logClick={data =>
|
||||
doLogClick("long_name_long_name_long_name", "long_name_long_name_long_name", data)
|
||||
}
|
||||
/>;
|
||||
|
||||
<BookingIntroPanel
|
||||
logClick={data => {
|
||||
doLogClick("long_name_long_name_long_name", "long_name_long_name_long_name", data)
|
||||
}}
|
||||
/>;
|
||||
|
||||
<Component
|
||||
onChange={(
|
||||
key: "possible_key_1" | "possible_key_2" | "possible_key_3",
|
||||
value: string | Immutable.List<string>,
|
||||
) => {
|
||||
this.setState({
|
||||
updatedTask: this.state.updatedTask.set(key, value)
|
||||
});
|
||||
}}
|
||||
/>;
|
||||
|
||||
<BookingIntroPanel>
|
||||
{data => doLogClick("short", "short", data)}
|
||||
</BookingIntroPanel>;
|
||||
|
||||
<BookingIntroPanel>
|
||||
{data =>
|
||||
doLogClick("long_name_long_name_long_name", "long_name_long_name_long_name", data)
|
||||
}
|
||||
</BookingIntroPanel>;
|
||||
|
||||
<BookingIntroPanel>
|
||||
{data => {
|
||||
doLogClick("long_name_long_name_long_name", "long_name_long_name_long_name", data)
|
||||
}}
|
||||
</BookingIntroPanel>;
|
||||
|
||||
<Component>
|
||||
{(
|
||||
key: "possible_key_1" | "possible_key_2" | "possible_key_3",
|
||||
value: string | Immutable.List<string>,
|
||||
) => {
|
||||
this.setState({
|
||||
updatedTask: this.state.updatedTask.set(key, value)
|
||||
});
|
||||
}}
|
||||
</Component>;
|
||||
|
||||
<SuspendyTree>
|
||||
<div style={{ height: 200, overflow: "scroll" }}>
|
||||
{Array(20)
|
||||
.fill()
|
||||
.map((_, i) => (
|
||||
<h2 key={i}>{i + 1}</h2>
|
||||
))}
|
||||
</div>
|
||||
</SuspendyTree>;
|
||||
<View
|
||||
style={
|
||||
{
|
||||
someVeryLongStyle1: "true",
|
||||
someVeryLongStyle2: "true",
|
||||
someVeryLongStyle3: "true",
|
||||
someVeryLongStyle4: "true"
|
||||
}
|
||||
}
|
||||
/>;
|
||||
|
||||
<View
|
||||
style={
|
||||
[
|
||||
{
|
||||
someVeryLongStyle1: "true",
|
||||
someVeryLongStyle2: "true",
|
||||
someVeryLongStyle3: "true",
|
||||
someVeryLongStyle4: "true"
|
||||
}
|
||||
]
|
||||
}
|
||||
/>;
|
||||
|
||||
<Something>
|
||||
{() => (
|
||||
<SomethingElse>
|
||||
<span />
|
||||
</SomethingElse>
|
||||
)}
|
||||
</Something>;
|
||||
|
||||
<Something>
|
||||
{items.map(item => (
|
||||
<SomethingElse>
|
||||
<span />
|
||||
</SomethingElse>
|
||||
))}
|
||||
</Something>;
|
||||
|
||||
<Something>
|
||||
{function() {
|
||||
return (
|
||||
<SomethingElse>
|
||||
<span />
|
||||
</SomethingElse>
|
||||
);
|
||||
}}
|
||||
</Something>;
|
||||
|
||||
<RadioListItem
|
||||
key={option}
|
||||
imageSource={this.props.veryBigItemImageSourceFunc &&
|
||||
this.props.veryBigItemImageSourceFunc(option)}
|
||||
imageSize={this.props.veryBigItemImageSize}
|
||||
imageView={this.props.veryBigItemImageViewFunc &&
|
||||
this.props.veryBigItemImageViewFunc(option)}
|
||||
heading={this.props.displayTextFunc(option)}
|
||||
value={option}
|
||||
/>;
|
||||
|
||||
<ParentComponent prop={
|
||||
<Child>
|
||||
test
|
||||
</Child>
|
||||
}/>;
|
||||
|
||||
<BookingIntroPanel
|
||||
prop="long_string_make_to_force_break"
|
||||
logClick={data => doLogClick("short", "short", data)}
|
||||
/>;
|
||||
|
||||
<BookingIntroPanel
|
||||
logClick={data =>
|
||||
doLogClick("long_name_long_name_long_name", "long_name_long_name_long_name", data)
|
||||
}
|
||||
/>;
|
||||
|
||||
<BookingIntroPanel
|
||||
logClick={data => {
|
||||
doLogClick("long_name_long_name_long_name", "long_name_long_name_long_name", data)
|
||||
}}
|
||||
/>;
|
||||
|
||||
<Component
|
||||
onChange={(
|
||||
key: "possible_key_1" | "possible_key_2" | "possible_key_3",
|
||||
value: string | Immutable.List<string>,
|
||||
) => {
|
||||
this.setState({
|
||||
updatedTask: this.state.updatedTask.set(key, value)
|
||||
});
|
||||
}}
|
||||
/>;
|
||||
|
||||
<BookingIntroPanel>
|
||||
{data => doLogClick("short", "short", data)}
|
||||
</BookingIntroPanel>;
|
||||
|
||||
<BookingIntroPanel>
|
||||
{data =>
|
||||
doLogClick("long_name_long_name_long_name", "long_name_long_name_long_name", data)
|
||||
}
|
||||
</BookingIntroPanel>;
|
||||
|
||||
<BookingIntroPanel>
|
||||
{data => {
|
||||
doLogClick("long_name_long_name_long_name", "long_name_long_name_long_name", data)
|
||||
}}
|
||||
</BookingIntroPanel>;
|
||||
|
||||
<Component>
|
||||
{(
|
||||
key: "possible_key_1" | "possible_key_2" | "possible_key_3",
|
||||
value: string | Immutable.List<string>,
|
||||
) => {
|
||||
this.setState({
|
||||
updatedTask: this.state.updatedTask.set(key, value)
|
||||
});
|
||||
}}
|
||||
</Component>;
|
||||
|
||||
<SuspendyTree>
|
||||
<div style={{ height: 200, overflow: "scroll" }}>
|
||||
{Array(20)
|
||||
.fill()
|
||||
.map((_, i) => (
|
||||
<h2 key={i}>{i + 1}</h2>
|
||||
))}
|
||||
</div>
|
||||
</SuspendyTree>;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const vscode = require("vscode");
|
||||
const {getDir, getActiveFile, uint8arrayToString} = require("./utils");
|
||||
|
||||
let outChannel;
|
||||
let _commands;
|
||||
const vscode = require("vscode");
|
||||
const {getDir, getActiveFile, uint8arrayToString} = require("./utils");
|
||||
|
||||
let outChannel;
|
||||
let _commands;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<template>
|
||||
<div>{{foo}}</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
computed: { foo( ): string { return "foo"; }, },
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>{{foo}}</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
computed: { foo( ): string { return "foo"; }, },
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script lang="tsx">
|
||||
import {VNode} from "vue"
|
||||
export default {
|
||||
computed: { foo( ):string { return "foo" }, },
|
||||
render(h):VNode { return <div>{ this.foo }</div> },
|
||||
}
|
||||
</script>
|
||||
<script lang="tsx">
|
||||
import {VNode} from "vue"
|
||||
export default {
|
||||
computed: { foo( ):string { return "foo" }, },
|
||||
render(h):VNode { return <div>{ this.foo }</div> },
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
'meaningfully escaped alphabetical characters \n \r \v \t \b \f \u2713 \x61'
|
||||
'escaped newline \
|
||||
'
|
||||
'escaped carriage return \
|
||||
'escaped carriage return \
|
||||
'
|
||||
'escaped \u2028 \
'
|
||||
'escaped \u2029 \
'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class C {
|
||||
"foo"();
|
||||
"bar"() { }
|
||||
}
|
||||
class C {
|
||||
"foo"();
|
||||
"bar"() { }
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// @target: es6
|
||||
async function f() {
|
||||
<number> await 0;
|
||||
typeof await 0;
|
||||
void await 0;
|
||||
await void <string> typeof <number> void await 0;
|
||||
await await 0;
|
||||
}
|
||||
// @target: es6
|
||||
async function f() {
|
||||
<number> await 0;
|
||||
typeof await 0;
|
||||
void await 0;
|
||||
await void <string> typeof <number> void await 0;
|
||||
await await 0;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
class a {
|
||||
static b: any;
|
||||
}
|
||||
|
||||
var b = (<any>a);
|
||||
var b = (<any>a).b;
|
||||
var b = (<any>a.b).c;
|
||||
var b = (<any>a.b()).c;
|
||||
var b = (<any>new a);
|
||||
var b = (<any>new a.b);
|
||||
var b = (<any>new a).b
|
||||
class a {
|
||||
static b: any;
|
||||
}
|
||||
|
||||
var b = (<any>a);
|
||||
var b = (<any>a).b;
|
||||
var b = (<any>a.b).c;
|
||||
var b = (<any>a.b()).c;
|
||||
var b = (<any>new a);
|
||||
var b = (<any>new a.b);
|
||||
var b = (<any>new a).b
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
|
||||
var x : any = 0;
|
||||
var z = <number> x;
|
||||
var y = x + z;
|
||||
|
||||
var a = <any>0;
|
||||
var b = <boolean>true;
|
||||
var s = <string>"";
|
||||
|
||||
var ar = <any[]>null;
|
||||
|
||||
var f = <(res : number) => void>null;
|
||||
|
||||
declare class Point
|
||||
{
|
||||
x: number;
|
||||
y: number;
|
||||
add(dx: number, dy: number): Point;
|
||||
mult(p: Point): Point;
|
||||
constructor(x: number, y: number);
|
||||
}
|
||||
|
||||
var p_cast = <Point> ({
|
||||
x: 0,
|
||||
y: 0,
|
||||
add: function(dx, dy) {
|
||||
return new Point(this.x + dx, this.y + dy);
|
||||
},
|
||||
mult: function(p) { return p; }
|
||||
})
|
||||
|
||||
var x : any = 0;
|
||||
var z = <number> x;
|
||||
var y = x + z;
|
||||
|
||||
var a = <any>0;
|
||||
var b = <boolean>true;
|
||||
var s = <string>"";
|
||||
|
||||
var ar = <any[]>null;
|
||||
|
||||
var f = <(res : number) => void>null;
|
||||
|
||||
declare class Point
|
||||
{
|
||||
x: number;
|
||||
y: number;
|
||||
add(dx: number, dy: number): Point;
|
||||
mult(p: Point): Point;
|
||||
constructor(x: number, y: number);
|
||||
}
|
||||
|
||||
var p_cast = <Point> ({
|
||||
x: 0,
|
||||
y: 0,
|
||||
add: function(dx, dy) {
|
||||
return new Point(this.x + dx, this.y + dy);
|
||||
},
|
||||
mult: function(p) { return p; }
|
||||
})
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
// Regression test for #1002
|
||||
// Before fix this code would cause infinite loop
|
||||
|
||||
interface IObservable<T> {
|
||||
n: IObservable<T[]>; // Needed, must be T[]
|
||||
}
|
||||
|
||||
// Needed
|
||||
interface ISubject<T> extends IObservable<T> { }
|
||||
|
||||
interface Foo { x }
|
||||
interface Bar { y }
|
||||
|
||||
var values: IObservable<Foo>;
|
||||
var values2: ISubject<Bar>;
|
||||
values = values2;
|
||||
// Regression test for #1002
|
||||
// Before fix this code would cause infinite loop
|
||||
|
||||
interface IObservable<T> {
|
||||
n: IObservable<T[]>; // Needed, must be T[]
|
||||
}
|
||||
|
||||
// Needed
|
||||
interface ISubject<T> extends IObservable<T> { }
|
||||
|
||||
interface Foo { x }
|
||||
interface Bar { y }
|
||||
|
||||
var values: IObservable<Foo>;
|
||||
var values2: ISubject<Bar>;
|
||||
values = values2;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace hello.hi.world
|
||||
{
|
||||
function foo() {}
|
||||
}
|
||||
namespace hello.hi.world
|
||||
{
|
||||
function foo() {}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// dot f g x = f(g(x))
|
||||
var dot: <T, S>(f: (_: T) => S) => <U>(g: (_: U) => T) => (_: U) => S;
|
||||
dot = <T, S>(f: (_: T) => S) => <U>(g: (_: U) => T): (r:U) => S => (x) => f(g(x));
|
||||
var id: <T>(x:T) => T;
|
||||
// dot f g x = f(g(x))
|
||||
var dot: <T, S>(f: (_: T) => S) => <U>(g: (_: U) => T) => (_: U) => S;
|
||||
dot = <T, S>(f: (_: T) => S) => <U>(g: (_: U) => T): (r:U) => S => (x) => f(g(x));
|
||||
var id: <T>(x:T) => T;
|
||||
var r23 = dot(id)(id);
|
|
@ -1,11 +1,11 @@
|
|||
// @declaration: true
|
||||
module M {
|
||||
module P.Q { } // This shouldnt be emitted
|
||||
}
|
||||
|
||||
module M {
|
||||
export module R.S { } //This should be emitted
|
||||
}
|
||||
|
||||
module T.U { // This needs to be emitted
|
||||
// @declaration: true
|
||||
module M {
|
||||
module P.Q { } // This shouldnt be emitted
|
||||
}
|
||||
|
||||
module M {
|
||||
export module R.S { } //This should be emitted
|
||||
}
|
||||
|
||||
module T.U { // This needs to be emitted
|
||||
}
|
|
@ -1,37 +1,37 @@
|
|||
var x = 0;
|
||||
|
||||
// errors
|
||||
1 ++;
|
||||
|
||||
(1)++;
|
||||
(1)--;
|
||||
|
||||
++(1);
|
||||
--(1);
|
||||
|
||||
(1 + 2)++;
|
||||
(1 + 2)--;
|
||||
|
||||
++(1 + 2);
|
||||
--(1 + 2);
|
||||
|
||||
(x + x)++;
|
||||
(x + x)--;
|
||||
|
||||
++(x + x);
|
||||
--(x + x);
|
||||
|
||||
//OK
|
||||
x++;
|
||||
x--;
|
||||
|
||||
++x;
|
||||
--x;
|
||||
|
||||
(x)++;
|
||||
--(x);
|
||||
|
||||
((x))++;
|
||||
((x))--;
|
||||
|
||||
x[x++]++;
|
||||
var x = 0;
|
||||
|
||||
// errors
|
||||
1 ++;
|
||||
|
||||
(1)++;
|
||||
(1)--;
|
||||
|
||||
++(1);
|
||||
--(1);
|
||||
|
||||
(1 + 2)++;
|
||||
(1 + 2)--;
|
||||
|
||||
++(1 + 2);
|
||||
--(1 + 2);
|
||||
|
||||
(x + x)++;
|
||||
(x + x)--;
|
||||
|
||||
++(x + x);
|
||||
--(x + x);
|
||||
|
||||
//OK
|
||||
x++;
|
||||
x--;
|
||||
|
||||
++x;
|
||||
--x;
|
||||
|
||||
(x)++;
|
||||
--(x);
|
||||
|
||||
((x))++;
|
||||
((x))--;
|
||||
|
||||
x[x++]++;
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
interface Foo {
|
||||
bar: number = 5;
|
||||
}
|
||||
interface Foo {
|
||||
bar: number = 5;
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
// @target: es5
|
||||
// @module: commonjs
|
||||
// @declaration: true
|
||||
|
||||
declare module "foo" {
|
||||
export var before: C;
|
||||
|
||||
export default class C {
|
||||
method(): C;
|
||||
}
|
||||
|
||||
export var after: C;
|
||||
|
||||
export var t: typeof C;
|
||||
}
|
||||
|
||||
// @target: es5
|
||||
// @module: commonjs
|
||||
// @declaration: true
|
||||
|
||||
declare module "foo" {
|
||||
export var before: C;
|
||||
|
||||
export default class C {
|
||||
method(): C;
|
||||
}
|
||||
|
||||
export var after: C;
|
||||
|
||||
export var t: typeof C;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// overloading on arity not allowed
|
||||
interface C {
|
||||
f<T>(): string;
|
||||
f<T, U>(): string;
|
||||
|
||||
<T>(): string;
|
||||
<T, U>(): string;
|
||||
|
||||
new <T>(): string;
|
||||
new <T, U>(): string;
|
||||
}
|
||||
// overloading on arity not allowed
|
||||
interface C {
|
||||
f<T>(): string;
|
||||
f<T, U>(): string;
|
||||
|
||||
<T>(): string;
|
||||
<T, U>(): string;
|
||||
|
||||
new <T>(): string;
|
||||
new <T, U>(): string;
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
function a() {
|
||||
let global = 1;
|
||||
}
|
||||
function b() {
|
||||
class global {}
|
||||
}
|
||||
|
||||
namespace global {
|
||||
}
|
||||
|
||||
function foo(global: number) {
|
||||
}
|
||||
|
||||
let obj = {
|
||||
global: "123"
|
||||
function a() {
|
||||
let global = 1;
|
||||
}
|
||||
function b() {
|
||||
class global {}
|
||||
}
|
||||
|
||||
namespace global {
|
||||
}
|
||||
|
||||
function foo(global: number) {
|
||||
}
|
||||
|
||||
let obj = {
|
||||
global: "123"
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
// These used to be indexers, now they are computed properties
|
||||
interface I {
|
||||
[x = '']: string;
|
||||
}
|
||||
|
||||
class C {
|
||||
[x = 0]: string
|
||||
// These used to be indexers, now they are computed properties
|
||||
interface I {
|
||||
[x = '']: string;
|
||||
}
|
||||
|
||||
class C {
|
||||
[x = 0]: string
|
||||
}
|
|
@ -1,18 +1,18 @@
|
|||
// Repro from #13351
|
||||
|
||||
type Meta<T, A> = {
|
||||
[P in keyof T]: {
|
||||
value: T[P];
|
||||
also: A;
|
||||
readonly children: Meta<T[P], A>;
|
||||
};
|
||||
}
|
||||
|
||||
interface Input {
|
||||
x: string;
|
||||
y: number;
|
||||
}
|
||||
|
||||
declare const output: Meta<Input, boolean>;
|
||||
|
||||
const shouldFail: { important: boolean } = output.x.children;
|
||||
// Repro from #13351
|
||||
|
||||
type Meta<T, A> = {
|
||||
[P in keyof T]: {
|
||||
value: T[P];
|
||||
also: A;
|
||||
readonly children: Meta<T[P], A>;
|
||||
};
|
||||
}
|
||||
|
||||
interface Input {
|
||||
x: string;
|
||||
y: number;
|
||||
}
|
||||
|
||||
declare const output: Meta<Input, boolean>;
|
||||
|
||||
const shouldFail: { important: boolean } = output.x.children;
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
interface I {
|
||||
public [a: string]: number;
|
||||
interface I {
|
||||
public [a: string]: number;
|
||||
}
|
|
@ -1,153 +1,153 @@
|
|||
//@declaration: true
|
||||
module m1 {
|
||||
export module m1_M1_public {
|
||||
export class c1 {
|
||||
}
|
||||
export function f1() {
|
||||
return new c1;
|
||||
}
|
||||
export var v1 = c1;
|
||||
export var v2: c1;
|
||||
}
|
||||
|
||||
module m1_M2_private {
|
||||
export class c1 {
|
||||
}
|
||||
export function f1() {
|
||||
return new c1;
|
||||
}
|
||||
export var v1 = c1;
|
||||
export var v2: c1;
|
||||
}
|
||||
|
||||
//export declare module "m1_M3_public" {
|
||||
// export function f1();
|
||||
// export class c1 {
|
||||
// }
|
||||
// export var v1: { new (): c1; };
|
||||
// export var v2: c1;
|
||||
//}
|
||||
|
||||
//declare module "m1_M4_private" {
|
||||
// export function f1();
|
||||
// export class c1 {
|
||||
// }
|
||||
// export var v1: { new (): c1; };
|
||||
// export var v2: c1;
|
||||
//}
|
||||
|
||||
import m1_im1_private = m1_M1_public;
|
||||
export var m1_im1_private_v1_public = m1_im1_private.c1;
|
||||
export var m1_im1_private_v2_public = new m1_im1_private.c1();
|
||||
export var m1_im1_private_v3_public = m1_im1_private.f1;
|
||||
export var m1_im1_private_v4_public = m1_im1_private.f1();
|
||||
var m1_im1_private_v1_private = m1_im1_private.c1;
|
||||
var m1_im1_private_v2_private = new m1_im1_private.c1();
|
||||
var m1_im1_private_v3_private = m1_im1_private.f1;
|
||||
var m1_im1_private_v4_private = m1_im1_private.f1();
|
||||
|
||||
|
||||
import m1_im2_private = m1_M2_private;
|
||||
export var m1_im2_private_v1_public = m1_im2_private.c1;
|
||||
export var m1_im2_private_v2_public = new m1_im2_private.c1();
|
||||
export var m1_im2_private_v3_public = m1_im2_private.f1;
|
||||
export var m1_im2_private_v4_public = m1_im2_private.f1();
|
||||
var m1_im2_private_v1_private = m1_im2_private.c1;
|
||||
var m1_im2_private_v2_private = new m1_im2_private.c1();
|
||||
var m1_im2_private_v3_private = m1_im2_private.f1;
|
||||
var m1_im2_private_v4_private = m1_im2_private.f1();
|
||||
|
||||
//import m1_im3_private = require("m1_M3_public");
|
||||
//export var m1_im3_private_v1_public = m1_im3_private.c1;
|
||||
//export var m1_im3_private_v2_public = new m1_im3_private.c1();
|
||||
//export var m1_im3_private_v3_public = m1_im3_private.f1;
|
||||
//export var m1_im3_private_v4_public = m1_im3_private.f1();
|
||||
//var m1_im3_private_v1_private = m1_im3_private.c1;
|
||||
//var m1_im3_private_v2_private = new m1_im3_private.c1();
|
||||
//var m1_im3_private_v3_private = m1_im3_private.f1;
|
||||
//var m1_im3_private_v4_private = m1_im3_private.f1();
|
||||
|
||||
//import m1_im4_private = require("m1_M4_private");
|
||||
//export var m1_im4_private_v1_public = m1_im4_private.c1;
|
||||
//export var m1_im4_private_v2_public = new m1_im4_private.c1();
|
||||
//export var m1_im4_private_v3_public = m1_im4_private.f1;
|
||||
//export var m1_im4_private_v4_public = m1_im4_private.f1();
|
||||
//var m1_im4_private_v1_private = m1_im4_private.c1;
|
||||
//var m1_im4_private_v2_private = new m1_im4_private.c1();
|
||||
//var m1_im4_private_v3_private = m1_im4_private.f1;
|
||||
//var m1_im4_private_v4_private = m1_im4_private.f1();
|
||||
|
||||
export import m1_im1_public = m1_M1_public;
|
||||
export import m1_im2_public = m1_M2_private;
|
||||
//export import m1_im3_public = require("m1_M3_public");
|
||||
//export import m1_im4_public = require("m1_M4_private");
|
||||
}
|
||||
|
||||
module glo_M1_public {
|
||||
export class c1 {
|
||||
}
|
||||
export function f1() {
|
||||
return new c1;
|
||||
}
|
||||
export var v1 = c1;
|
||||
export var v2: c1;
|
||||
}
|
||||
|
||||
declare module "glo_M2_public" {
|
||||
export function f1();
|
||||
export class c1 {
|
||||
}
|
||||
export var v1: { new (): c1; };
|
||||
export var v2: c1;
|
||||
}
|
||||
|
||||
declare module "use_glo_M1_public" {
|
||||
import use_glo_M1_public = glo_M1_public;
|
||||
export var use_glo_M1_public_v1_public: { new (): use_glo_M1_public.c1; };
|
||||
export var use_glo_M1_public_v2_public: typeof use_glo_M1_public;
|
||||
export var use_glo_M1_public_v3_public: ()=> use_glo_M1_public.c1;
|
||||
var use_glo_M1_public_v1_private: { new (): use_glo_M1_public.c1; };
|
||||
var use_glo_M1_public_v2_private: typeof use_glo_M1_public;
|
||||
var use_glo_M1_public_v3_private: () => use_glo_M1_public.c1;
|
||||
|
||||
import use_glo_M2_public = require("glo_M2_public");
|
||||
export var use_glo_M2_public_v1_public: { new (): use_glo_M2_public.c1; };
|
||||
export var use_glo_M2_public_v2_public: typeof use_glo_M2_public;
|
||||
export var use_glo_M2_public_v3_public: () => use_glo_M2_public.c1;
|
||||
var use_glo_M2_public_v1_private: { new (): use_glo_M2_public.c1; };
|
||||
var use_glo_M2_public_v2_private: typeof use_glo_M2_public;
|
||||
var use_glo_M2_public_v3_private: () => use_glo_M2_public.c1;
|
||||
|
||||
module m2 {
|
||||
//import errorImport = require("glo_M2_public");
|
||||
import nonerrorImport = glo_M1_public;
|
||||
|
||||
module m5 {
|
||||
//import m5_errorImport = require("glo_M2_public");
|
||||
import m5_nonerrorImport = glo_M1_public;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare module "anotherParseError" {
|
||||
module m2 {
|
||||
//declare module "abc" {
|
||||
//}
|
||||
}
|
||||
|
||||
module m2 {
|
||||
//module "abc2" {
|
||||
//}
|
||||
}
|
||||
//module "abc3" {
|
||||
//}
|
||||
}
|
||||
|
||||
module m2 {
|
||||
//import m3 = require("use_glo_M1_public");
|
||||
module m4 {
|
||||
var a = 10;
|
||||
//import m2 = require("use_glo_M1_public");
|
||||
}
|
||||
|
||||
//@declaration: true
|
||||
module m1 {
|
||||
export module m1_M1_public {
|
||||
export class c1 {
|
||||
}
|
||||
export function f1() {
|
||||
return new c1;
|
||||
}
|
||||
export var v1 = c1;
|
||||
export var v2: c1;
|
||||
}
|
||||
|
||||
module m1_M2_private {
|
||||
export class c1 {
|
||||
}
|
||||
export function f1() {
|
||||
return new c1;
|
||||
}
|
||||
export var v1 = c1;
|
||||
export var v2: c1;
|
||||
}
|
||||
|
||||
//export declare module "m1_M3_public" {
|
||||
// export function f1();
|
||||
// export class c1 {
|
||||
// }
|
||||
// export var v1: { new (): c1; };
|
||||
// export var v2: c1;
|
||||
//}
|
||||
|
||||
//declare module "m1_M4_private" {
|
||||
// export function f1();
|
||||
// export class c1 {
|
||||
// }
|
||||
// export var v1: { new (): c1; };
|
||||
// export var v2: c1;
|
||||
//}
|
||||
|
||||
import m1_im1_private = m1_M1_public;
|
||||
export var m1_im1_private_v1_public = m1_im1_private.c1;
|
||||
export var m1_im1_private_v2_public = new m1_im1_private.c1();
|
||||
export var m1_im1_private_v3_public = m1_im1_private.f1;
|
||||
export var m1_im1_private_v4_public = m1_im1_private.f1();
|
||||
var m1_im1_private_v1_private = m1_im1_private.c1;
|
||||
var m1_im1_private_v2_private = new m1_im1_private.c1();
|
||||
var m1_im1_private_v3_private = m1_im1_private.f1;
|
||||
var m1_im1_private_v4_private = m1_im1_private.f1();
|
||||
|
||||
|
||||
import m1_im2_private = m1_M2_private;
|
||||
export var m1_im2_private_v1_public = m1_im2_private.c1;
|
||||
export var m1_im2_private_v2_public = new m1_im2_private.c1();
|
||||
export var m1_im2_private_v3_public = m1_im2_private.f1;
|
||||
export var m1_im2_private_v4_public = m1_im2_private.f1();
|
||||
var m1_im2_private_v1_private = m1_im2_private.c1;
|
||||
var m1_im2_private_v2_private = new m1_im2_private.c1();
|
||||
var m1_im2_private_v3_private = m1_im2_private.f1;
|
||||
var m1_im2_private_v4_private = m1_im2_private.f1();
|
||||
|
||||
//import m1_im3_private = require("m1_M3_public");
|
||||
//export var m1_im3_private_v1_public = m1_im3_private.c1;
|
||||
//export var m1_im3_private_v2_public = new m1_im3_private.c1();
|
||||
//export var m1_im3_private_v3_public = m1_im3_private.f1;
|
||||
//export var m1_im3_private_v4_public = m1_im3_private.f1();
|
||||
//var m1_im3_private_v1_private = m1_im3_private.c1;
|
||||
//var m1_im3_private_v2_private = new m1_im3_private.c1();
|
||||
//var m1_im3_private_v3_private = m1_im3_private.f1;
|
||||
//var m1_im3_private_v4_private = m1_im3_private.f1();
|
||||
|
||||
//import m1_im4_private = require("m1_M4_private");
|
||||
//export var m1_im4_private_v1_public = m1_im4_private.c1;
|
||||
//export var m1_im4_private_v2_public = new m1_im4_private.c1();
|
||||
//export var m1_im4_private_v3_public = m1_im4_private.f1;
|
||||
//export var m1_im4_private_v4_public = m1_im4_private.f1();
|
||||
//var m1_im4_private_v1_private = m1_im4_private.c1;
|
||||
//var m1_im4_private_v2_private = new m1_im4_private.c1();
|
||||
//var m1_im4_private_v3_private = m1_im4_private.f1;
|
||||
//var m1_im4_private_v4_private = m1_im4_private.f1();
|
||||
|
||||
export import m1_im1_public = m1_M1_public;
|
||||
export import m1_im2_public = m1_M2_private;
|
||||
//export import m1_im3_public = require("m1_M3_public");
|
||||
//export import m1_im4_public = require("m1_M4_private");
|
||||
}
|
||||
|
||||
module glo_M1_public {
|
||||
export class c1 {
|
||||
}
|
||||
export function f1() {
|
||||
return new c1;
|
||||
}
|
||||
export var v1 = c1;
|
||||
export var v2: c1;
|
||||
}
|
||||
|
||||
declare module "glo_M2_public" {
|
||||
export function f1();
|
||||
export class c1 {
|
||||
}
|
||||
export var v1: { new (): c1; };
|
||||
export var v2: c1;
|
||||
}
|
||||
|
||||
declare module "use_glo_M1_public" {
|
||||
import use_glo_M1_public = glo_M1_public;
|
||||
export var use_glo_M1_public_v1_public: { new (): use_glo_M1_public.c1; };
|
||||
export var use_glo_M1_public_v2_public: typeof use_glo_M1_public;
|
||||
export var use_glo_M1_public_v3_public: ()=> use_glo_M1_public.c1;
|
||||
var use_glo_M1_public_v1_private: { new (): use_glo_M1_public.c1; };
|
||||
var use_glo_M1_public_v2_private: typeof use_glo_M1_public;
|
||||
var use_glo_M1_public_v3_private: () => use_glo_M1_public.c1;
|
||||
|
||||
import use_glo_M2_public = require("glo_M2_public");
|
||||
export var use_glo_M2_public_v1_public: { new (): use_glo_M2_public.c1; };
|
||||
export var use_glo_M2_public_v2_public: typeof use_glo_M2_public;
|
||||
export var use_glo_M2_public_v3_public: () => use_glo_M2_public.c1;
|
||||
var use_glo_M2_public_v1_private: { new (): use_glo_M2_public.c1; };
|
||||
var use_glo_M2_public_v2_private: typeof use_glo_M2_public;
|
||||
var use_glo_M2_public_v3_private: () => use_glo_M2_public.c1;
|
||||
|
||||
module m2 {
|
||||
//import errorImport = require("glo_M2_public");
|
||||
import nonerrorImport = glo_M1_public;
|
||||
|
||||
module m5 {
|
||||
//import m5_errorImport = require("glo_M2_public");
|
||||
import m5_nonerrorImport = glo_M1_public;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare module "anotherParseError" {
|
||||
module m2 {
|
||||
//declare module "abc" {
|
||||
//}
|
||||
}
|
||||
|
||||
module m2 {
|
||||
//module "abc2" {
|
||||
//}
|
||||
}
|
||||
//module "abc3" {
|
||||
//}
|
||||
}
|
||||
|
||||
module m2 {
|
||||
//import m3 = require("use_glo_M1_public");
|
||||
module m4 {
|
||||
var a = 10;
|
||||
//import m2 = require("use_glo_M1_public");
|
||||
}
|
||||
|
||||
}
|
|
@ -1,26 +1,26 @@
|
|||
declare var n;
|
||||
|
||||
declare var m: string;
|
||||
|
||||
declare function fn1();
|
||||
|
||||
declare function fn2(n: string): number;
|
||||
|
||||
declare function fn3(n: string): number;
|
||||
declare function fn4(n: number, y: number): string;
|
||||
|
||||
declare function fn5(x, y?);
|
||||
declare function fn6(e?);
|
||||
declare function fn7(x, y?, ...z);
|
||||
declare function fn8(y?, ...z: number[]);
|
||||
declare function fn9(...q: {}[]);
|
||||
declare function fn10<T>(...q: T[]);
|
||||
|
||||
declare class cls {
|
||||
constructor();
|
||||
method(): cls;
|
||||
static static(p): number;
|
||||
static q;
|
||||
private fn();
|
||||
private static fns();
|
||||
}
|
||||
declare var n;
|
||||
|
||||
declare var m: string;
|
||||
|
||||
declare function fn1();
|
||||
|
||||
declare function fn2(n: string): number;
|
||||
|
||||
declare function fn3(n: string): number;
|
||||
declare function fn4(n: number, y: number): string;
|
||||
|
||||
declare function fn5(x, y?);
|
||||
declare function fn6(e?);
|
||||
declare function fn7(x, y?, ...z);
|
||||
declare function fn8(y?, ...z: number[]);
|
||||
declare function fn9(...q: {}[]);
|
||||
declare function fn10<T>(...q: T[]);
|
||||
|
||||
declare class cls {
|
||||
constructor();
|
||||
method(): cls;
|
||||
static static(p): number;
|
||||
static q;
|
||||
private fn();
|
||||
private static fns();
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
abstract class A {
|
||||
abstract get a();
|
||||
abstract get aa() { return 1; }
|
||||
abstract set b(x: string);
|
||||
abstract set bb(x: string) {}
|
||||
}
|
||||
|
||||
abstract class A {
|
||||
abstract get a();
|
||||
abstract get aa() { return 1; }
|
||||
abstract set b(x: string);
|
||||
abstract set bb(x: string) {}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class abstract {
|
||||
foo() { return 1; }
|
||||
}
|
||||
|
||||
class abstract {
|
||||
foo() { return 1; }
|
||||
}
|
||||
|
||||
new abstract;
|
|
@ -1,6 +1,6 @@
|
|||
abstract class A { }
|
||||
|
||||
var AAA: new() => A;
|
||||
|
||||
AAA = A;
|
||||
abstract class A { }
|
||||
|
||||
var AAA: new() => A;
|
||||
|
||||
AAA = A;
|
||||
AAA = "asdf";
|
|
@ -1,13 +1,13 @@
|
|||
|
||||
var I: IConstructor;
|
||||
|
||||
abstract class A {
|
||||
x: number;
|
||||
static y: number;
|
||||
}
|
||||
|
||||
var AA: typeof A;
|
||||
AA = I;
|
||||
|
||||
var AAA: typeof I;
|
||||
|
||||
var I: IConstructor;
|
||||
|
||||
abstract class A {
|
||||
x: number;
|
||||
static y: number;
|
||||
}
|
||||
|
||||
var AA: typeof A;
|
||||
AA = I;
|
||||
|
||||
var AAA: typeof I;
|
||||
AAA = A;
|
|
@ -1,14 +1,14 @@
|
|||
|
||||
class A {}
|
||||
|
||||
abstract class B extends A {}
|
||||
|
||||
class C extends B {}
|
||||
|
||||
var AA : typeof A = B;
|
||||
var BB : typeof B = A;
|
||||
var CC : typeof C = B;
|
||||
|
||||
new AA;
|
||||
new BB;
|
||||
|
||||
class A {}
|
||||
|
||||
abstract class B extends A {}
|
||||
|
||||
class C extends B {}
|
||||
|
||||
var AA : typeof A = B;
|
||||
var BB : typeof B = A;
|
||||
var CC : typeof C = B;
|
||||
|
||||
new AA;
|
||||
new BB;
|
||||
new CC;
|
|
@ -1,9 +1,9 @@
|
|||
abstract class foo {
|
||||
protected abstract test();
|
||||
}
|
||||
|
||||
class bar extends foo {
|
||||
test() {
|
||||
}
|
||||
}
|
||||
abstract class foo {
|
||||
protected abstract test();
|
||||
}
|
||||
|
||||
class bar extends foo {
|
||||
test() {
|
||||
}
|
||||
}
|
||||
var x = new bar();
|
|
@ -1,16 +1,16 @@
|
|||
|
||||
class A {
|
||||
foo() {}
|
||||
}
|
||||
|
||||
abstract class B extends A {
|
||||
abstract bar();
|
||||
}
|
||||
|
||||
class C extends B { }
|
||||
|
||||
abstract class D extends B {}
|
||||
|
||||
class E extends B {
|
||||
bar() {}
|
||||
|
||||
class A {
|
||||
foo() {}
|
||||
}
|
||||
|
||||
abstract class B extends A {
|
||||
abstract bar();
|
||||
}
|
||||
|
||||
class C extends B { }
|
||||
|
||||
abstract class D extends B {}
|
||||
|
||||
class E extends B {
|
||||
bar() {}
|
||||
}
|
|
@ -1,17 +1,17 @@
|
|||
|
||||
class A {}
|
||||
abstract class B extends A {}
|
||||
|
||||
function NewA(Factory: typeof A) {
|
||||
return new A;
|
||||
}
|
||||
|
||||
function NewB(Factory: typeof B) {
|
||||
return new B;
|
||||
}
|
||||
|
||||
NewA(A);
|
||||
NewA(B);
|
||||
|
||||
NewB(A);
|
||||
|
||||
class A {}
|
||||
abstract class B extends A {}
|
||||
|
||||
function NewA(Factory: typeof A) {
|
||||
return new A;
|
||||
}
|
||||
|
||||
function NewB(Factory: typeof B) {
|
||||
return new B;
|
||||
}
|
||||
|
||||
NewA(A);
|
||||
NewA(B);
|
||||
|
||||
NewB(A);
|
||||
NewB(B);
|
|
@ -1,25 +1,25 @@
|
|||
abstract class A<T> {
|
||||
t: T;
|
||||
|
||||
abstract foo(): T;
|
||||
abstract bar(t: T);
|
||||
}
|
||||
|
||||
abstract class B<T> extends A {}
|
||||
|
||||
class C<T> extends A {}
|
||||
|
||||
class D extends A {}
|
||||
|
||||
class E<T> extends A {
|
||||
foo() { return this.t; }
|
||||
}
|
||||
|
||||
class F<T> extends A {
|
||||
bar(t : T) {}
|
||||
}
|
||||
|
||||
class G<T> extends A {
|
||||
foo() { return this.t; }
|
||||
bar(t: T) { }
|
||||
abstract class A<T> {
|
||||
t: T;
|
||||
|
||||
abstract foo(): T;
|
||||
abstract bar(t: T);
|
||||
}
|
||||
|
||||
abstract class B<T> extends A {}
|
||||
|
||||
class C<T> extends A {}
|
||||
|
||||
class D extends A {}
|
||||
|
||||
class E<T> extends A {
|
||||
foo() { return this.t; }
|
||||
}
|
||||
|
||||
class F<T> extends A {
|
||||
bar(t : T) {}
|
||||
}
|
||||
|
||||
class G<T> extends A {
|
||||
foo() { return this.t; }
|
||||
bar(t: T) { }
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
export abstract class A {}
|
||||
|
||||
new A;
|
||||
|
||||
|
||||
new myA;
|
||||
|
||||
export abstract class A {}
|
||||
|
||||
new A;
|
||||
|
||||
|
||||
new myA;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
export abstract class A {}
|
||||
export class B extends A {}
|
||||
|
||||
|
||||
new M.A;
|
||||
|
||||
export abstract class A {}
|
||||
export class B extends A {}
|
||||
|
||||
|
||||
new M.A;
|
||||
new M.B;
|
|
@ -1,21 +1,21 @@
|
|||
abstract class A {}
|
||||
|
||||
abstract class B extends A {}
|
||||
|
||||
class C extends A {}
|
||||
|
||||
abstract class AA {
|
||||
abstract foo();
|
||||
}
|
||||
|
||||
abstract class BB extends AA {}
|
||||
|
||||
class CC extends AA {}
|
||||
|
||||
class DD extends BB {}
|
||||
|
||||
abstract class EE extends BB {}
|
||||
|
||||
class FF extends CC {}
|
||||
|
||||
abstract class A {}
|
||||
|
||||
abstract class B extends A {}
|
||||
|
||||
class C extends A {}
|
||||
|
||||
abstract class AA {
|
||||
abstract foo();
|
||||
}
|
||||
|
||||
abstract class BB extends AA {}
|
||||
|
||||
class CC extends AA {}
|
||||
|
||||
class DD extends BB {}
|
||||
|
||||
abstract class EE extends BB {}
|
||||
|
||||
class FF extends CC {}
|
||||
|
||||
abstract class GG extends CC {}
|
|
@ -1,19 +1,19 @@
|
|||
|
||||
abstract class A {}
|
||||
|
||||
class B extends A {}
|
||||
|
||||
abstract class C extends B {}
|
||||
|
||||
new A;
|
||||
new A(1);
|
||||
new B;
|
||||
new C;
|
||||
|
||||
var a : A;
|
||||
var b : B;
|
||||
var c : C;
|
||||
|
||||
a = new B;
|
||||
b = new B;
|
||||
c = new B;
|
||||
|
||||
abstract class A {}
|
||||
|
||||
class B extends A {}
|
||||
|
||||
abstract class C extends B {}
|
||||
|
||||
new A;
|
||||
new A(1);
|
||||
new B;
|
||||
new C;
|
||||
|
||||
var a : A;
|
||||
var b : B;
|
||||
var c : C;
|
||||
|
||||
a = new B;
|
||||
b = new B;
|
||||
c = new B;
|
||||
|
|
|
@ -1,50 +1,50 @@
|
|||
class A {
|
||||
}
|
||||
|
||||
abstract class B {
|
||||
foo(): number { return this.bar(); }
|
||||
abstract bar() : number;
|
||||
}
|
||||
|
||||
new B;
|
||||
|
||||
var BB: typeof B = B;
|
||||
var AA: typeof A = BB;
|
||||
new AA;
|
||||
|
||||
function constructB(Factory : typeof B) {
|
||||
new Factory;
|
||||
}
|
||||
|
||||
var BB = B;
|
||||
new BB;
|
||||
|
||||
var x : any = C;
|
||||
new x;
|
||||
|
||||
class C extends B { }
|
||||
|
||||
abstract class D extends B { }
|
||||
|
||||
class E extends B {
|
||||
bar() { return 1; }
|
||||
}
|
||||
|
||||
abstract class F extends B {
|
||||
abstract foo() : number;
|
||||
bar() { return 2; }
|
||||
}
|
||||
|
||||
abstract class G {
|
||||
abstract qux(x : number) : string;
|
||||
abstract qux() : number;
|
||||
y : number;
|
||||
abstract quz(x : number, y : string) : boolean;
|
||||
|
||||
abstract nom(): boolean;
|
||||
nom(x : number): boolean;
|
||||
}
|
||||
|
||||
class H {
|
||||
abstract baz() : number;
|
||||
class A {
|
||||
}
|
||||
|
||||
abstract class B {
|
||||
foo(): number { return this.bar(); }
|
||||
abstract bar() : number;
|
||||
}
|
||||
|
||||
new B;
|
||||
|
||||
var BB: typeof B = B;
|
||||
var AA: typeof A = BB;
|
||||
new AA;
|
||||
|
||||
function constructB(Factory : typeof B) {
|
||||
new Factory;
|
||||
}
|
||||
|
||||
var BB = B;
|
||||
new BB;
|
||||
|
||||
var x : any = C;
|
||||
new x;
|
||||
|
||||
class C extends B { }
|
||||
|
||||
abstract class D extends B { }
|
||||
|
||||
class E extends B {
|
||||
bar() { return 1; }
|
||||
}
|
||||
|
||||
abstract class F extends B {
|
||||
abstract foo() : number;
|
||||
bar() { return 2; }
|
||||
}
|
||||
|
||||
abstract class G {
|
||||
abstract qux(x : number) : string;
|
||||
abstract qux() : number;
|
||||
y : number;
|
||||
abstract quz(x : number, y : string) : boolean;
|
||||
|
||||
abstract nom(): boolean;
|
||||
nom(x : number): boolean;
|
||||
}
|
||||
|
||||
class H {
|
||||
abstract baz() : number;
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
class A {
|
||||
abstract foo();
|
||||
}
|
||||
|
||||
class B {
|
||||
abstract foo() {}
|
||||
class A {
|
||||
abstract foo();
|
||||
}
|
||||
|
||||
class B {
|
||||
abstract foo() {}
|
||||
}
|
|
@ -1,3 +1,3 @@
|
|||
abstract class A {
|
||||
abstract foo() {}
|
||||
abstract class A {
|
||||
abstract foo() {}
|
||||
}
|
|
@ -1,15 +1,15 @@
|
|||
abstract class A {
|
||||
abstract foo_a();
|
||||
|
||||
public abstract foo_b();
|
||||
protected abstract foo_c();
|
||||
private abstract foo_d();
|
||||
|
||||
abstract public foo_bb();
|
||||
abstract protected foo_cc();
|
||||
abstract private foo_dd();
|
||||
|
||||
abstract static foo_d();
|
||||
|
||||
static abstract foo_e();
|
||||
abstract class A {
|
||||
abstract foo_a();
|
||||
|
||||
public abstract foo_b();
|
||||
protected abstract foo_c();
|
||||
private abstract foo_d();
|
||||
|
||||
abstract public foo_bb();
|
||||
abstract protected foo_cc();
|
||||
abstract private foo_dd();
|
||||
|
||||
abstract static foo_d();
|
||||
|
||||
static abstract foo_e();
|
||||
}
|
|
@ -1,24 +1,24 @@
|
|||
abstract class A {
|
||||
abstract foo();
|
||||
abstract foo() : number;
|
||||
abstract foo();
|
||||
|
||||
abstract bar();
|
||||
bar();
|
||||
abstract bar();
|
||||
|
||||
abstract baz();
|
||||
baz();
|
||||
abstract baz();
|
||||
baz() {}
|
||||
|
||||
qux();
|
||||
}
|
||||
|
||||
abstract class B {
|
||||
abstract foo() : number;
|
||||
abstract foo();
|
||||
x : number;
|
||||
abstract foo();
|
||||
abstract foo();
|
||||
abstract class A {
|
||||
abstract foo();
|
||||
abstract foo() : number;
|
||||
abstract foo();
|
||||
|
||||
abstract bar();
|
||||
bar();
|
||||
abstract bar();
|
||||
|
||||
abstract baz();
|
||||
baz();
|
||||
abstract baz();
|
||||
baz() {}
|
||||
|
||||
qux();
|
||||
}
|
||||
|
||||
abstract class B {
|
||||
abstract foo() : number;
|
||||
abstract foo();
|
||||
x : number;
|
||||
abstract foo();
|
||||
abstract foo();
|
||||
}
|
|
@ -1,23 +1,23 @@
|
|||
class A {
|
||||
foo() {}
|
||||
}
|
||||
|
||||
abstract class B extends A {
|
||||
abstract foo();
|
||||
}
|
||||
|
||||
abstract class AA {
|
||||
foo() {}
|
||||
abstract bar();
|
||||
}
|
||||
|
||||
abstract class BB extends AA {
|
||||
abstract foo();
|
||||
bar () {}
|
||||
}
|
||||
|
||||
class CC extends BB {}
|
||||
|
||||
class DD extends BB {
|
||||
foo() {}
|
||||
class A {
|
||||
foo() {}
|
||||
}
|
||||
|
||||
abstract class B extends A {
|
||||
abstract foo();
|
||||
}
|
||||
|
||||
abstract class AA {
|
||||
foo() {}
|
||||
abstract bar();
|
||||
}
|
||||
|
||||
abstract class BB extends AA {
|
||||
abstract foo();
|
||||
bar () {}
|
||||
}
|
||||
|
||||
class CC extends BB {}
|
||||
|
||||
class DD extends BB {
|
||||
foo() {}
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
abstract class A {
|
||||
abstract x : number;
|
||||
public abstract y : number;
|
||||
protected abstract z : number;
|
||||
private abstract w : number;
|
||||
|
||||
abstract m: () => void;
|
||||
|
||||
abstract foo_x() : number;
|
||||
public abstract foo_y() : number;
|
||||
protected abstract foo_z() : number;
|
||||
private abstract foo_w() : number;
|
||||
abstract class A {
|
||||
abstract x : number;
|
||||
public abstract y : number;
|
||||
protected abstract z : number;
|
||||
private abstract w : number;
|
||||
|
||||
abstract m: () => void;
|
||||
|
||||
abstract foo_x() : number;
|
||||
public abstract foo_y() : number;
|
||||
protected abstract foo_z() : number;
|
||||
private abstract foo_w() : number;
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
abstract class A {}
|
||||
|
||||
abstract
|
||||
class B {}
|
||||
|
||||
abstract
|
||||
|
||||
class C {}
|
||||
|
||||
new A;
|
||||
new B;
|
||||
abstract class A {}
|
||||
|
||||
abstract
|
||||
class B {}
|
||||
|
||||
abstract
|
||||
|
||||
class C {}
|
||||
|
||||
new A;
|
||||
new B;
|
||||
new C;
|
|
@ -1,25 +1,25 @@
|
|||
|
||||
class A {
|
||||
foo() { return 1; }
|
||||
}
|
||||
|
||||
abstract class B extends A {
|
||||
abstract foo();
|
||||
bar() { super.foo(); }
|
||||
baz() { return this.foo; }
|
||||
}
|
||||
|
||||
class C extends B {
|
||||
foo() { return 2; }
|
||||
qux() { return super.foo() || super.foo; }
|
||||
norf() { return super.bar(); }
|
||||
}
|
||||
|
||||
class AA {
|
||||
foo() { return 1; }
|
||||
bar() { return this.foo(); }
|
||||
}
|
||||
|
||||
abstract class BB extends AA {
|
||||
abstract foo();
|
||||
}
|
||||
|
||||
class A {
|
||||
foo() { return 1; }
|
||||
}
|
||||
|
||||
abstract class B extends A {
|
||||
abstract foo();
|
||||
bar() { super.foo(); }
|
||||
baz() { return this.foo; }
|
||||
}
|
||||
|
||||
class C extends B {
|
||||
foo() { return 2; }
|
||||
qux() { return super.foo() || super.foo; }
|
||||
norf() { return super.bar(); }
|
||||
}
|
||||
|
||||
class AA {
|
||||
foo() { return 1; }
|
||||
bar() { return this.foo(); }
|
||||
}
|
||||
|
||||
abstract class BB extends AA {
|
||||
abstract foo();
|
||||
}
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
abstract class A {
|
||||
abstract foo() : number;
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
foo() { return 1; }
|
||||
}
|
||||
|
||||
abstract class C extends A {
|
||||
abstract foo() : number;
|
||||
}
|
||||
|
||||
var a = new B;
|
||||
a.foo();
|
||||
|
||||
a = new C;
|
||||
abstract class A {
|
||||
abstract foo() : number;
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
foo() { return 1; }
|
||||
}
|
||||
|
||||
abstract class C extends A {
|
||||
abstract foo() : number;
|
||||
}
|
||||
|
||||
var a = new B;
|
||||
a.foo();
|
||||
|
||||
a = new C;
|
||||
a.foo();
|
|
@ -1,27 +1,27 @@
|
|||
class A {
|
||||
abstract foo();
|
||||
}
|
||||
|
||||
class B extends A {}
|
||||
|
||||
abstract class C extends A {}
|
||||
|
||||
class D extends A {
|
||||
foo() {}
|
||||
}
|
||||
|
||||
abstract class E extends A {
|
||||
foo() {}
|
||||
}
|
||||
|
||||
abstract class AA {
|
||||
abstract foo();
|
||||
}
|
||||
|
||||
class BB extends AA {}
|
||||
|
||||
abstract class CC extends AA {}
|
||||
|
||||
class DD extends AA {
|
||||
foo() {}
|
||||
class A {
|
||||
abstract foo();
|
||||
}
|
||||
|
||||
class B extends A {}
|
||||
|
||||
abstract class C extends A {}
|
||||
|
||||
class D extends A {
|
||||
foo() {}
|
||||
}
|
||||
|
||||
abstract class E extends A {
|
||||
foo() {}
|
||||
}
|
||||
|
||||
abstract class AA {
|
||||
abstract foo();
|
||||
}
|
||||
|
||||
class BB extends AA {}
|
||||
|
||||
abstract class CC extends AA {}
|
||||
|
||||
class DD extends AA {
|
||||
foo() {}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
class C { foo: string; }
|
||||
|
||||
var c: C;
|
||||
var r = c.toString();
|
||||
var r2 = c.hasOwnProperty('');
|
||||
var o: Object = c;
|
||||
var o2: {} = c;
|
||||
class C { foo: string; }
|
||||
|
||||
var c: C;
|
||||
var r = c.toString();
|
||||
var r2 = c.hasOwnProperty('');
|
||||
var o: Object = c;
|
||||
var o2: {} = c;
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
class C {
|
||||
foo: string;
|
||||
thing() { }
|
||||
static other() { }
|
||||
}
|
||||
|
||||
class D extends C {
|
||||
bar: string;
|
||||
}
|
||||
|
||||
var d: D;
|
||||
var r = d.foo;
|
||||
var r2 = d.bar;
|
||||
var r3 = d.thing();
|
||||
var r4 = D.other();
|
||||
|
||||
class C2<T> {
|
||||
foo: T;
|
||||
thing(x: T) { }
|
||||
static other<T>(x: T) { }
|
||||
}
|
||||
|
||||
class D2<T> extends C2<T> {
|
||||
bar: string;
|
||||
}
|
||||
|
||||
var d2: D2<string>;
|
||||
var r5 = d2.foo;
|
||||
var r6 = d2.bar;
|
||||
var r7 = d2.thing('');
|
||||
class C {
|
||||
foo: string;
|
||||
thing() { }
|
||||
static other() { }
|
||||
}
|
||||
|
||||
class D extends C {
|
||||
bar: string;
|
||||
}
|
||||
|
||||
var d: D;
|
||||
var r = d.foo;
|
||||
var r2 = d.bar;
|
||||
var r3 = d.thing();
|
||||
var r4 = D.other();
|
||||
|
||||
class C2<T> {
|
||||
foo: T;
|
||||
thing(x: T) { }
|
||||
static other<T>(x: T) { }
|
||||
}
|
||||
|
||||
class D2<T> extends C2<T> {
|
||||
bar: string;
|
||||
}
|
||||
|
||||
var d2: D2<string>;
|
||||
var r5 = d2.foo;
|
||||
var r6 = d2.bar;
|
||||
var r7 = d2.thing('');
|
||||
var r8 = D2.other(1);
|
|
@ -1,11 +1,11 @@
|
|||
class C extends E { foo: string; } // error
|
||||
|
||||
class D extends C { bar: string; }
|
||||
|
||||
class E extends D { baz: number; }
|
||||
|
||||
class C2<T> extends E2<T> { foo: T; } // error
|
||||
|
||||
class D2<T> extends C2<T> { bar: T; }
|
||||
|
||||
class C extends E { foo: string; } // error
|
||||
|
||||
class D extends C { bar: string; }
|
||||
|
||||
class E extends D { baz: number; }
|
||||
|
||||
class C2<T> extends E2<T> { foo: T; } // error
|
||||
|
||||
class D2<T> extends C2<T> { bar: T; }
|
||||
|
||||
class E2<T> extends D2<T> { baz: T; }
|
|
@ -1,7 +1,7 @@
|
|||
class Base<T> {
|
||||
foo: T;
|
||||
}
|
||||
|
||||
class Derived extends Base<string> {
|
||||
foo: any;
|
||||
}
|
||||
class Base<T> {
|
||||
foo: T;
|
||||
}
|
||||
|
||||
class Derived extends Base<string> {
|
||||
foo: any;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function foo() {
|
||||
class C { }
|
||||
function foo() {
|
||||
class C { }
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
var x = class C {
|
||||
}
|
||||
|
||||
var y = {
|
||||
foo: class C2 {
|
||||
}
|
||||
}
|
||||
|
||||
var z = class C4 {
|
||||
}
|
||||
var x = class C {
|
||||
}
|
||||
|
||||
var y = {
|
||||
foo: class C2 {
|
||||
}
|
||||
}
|
||||
|
||||
var z = class C4 {
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
class C {
|
||||
constructor(x = this) { }
|
||||
}
|
||||
|
||||
class D<T> {
|
||||
constructor(x = this) { }
|
||||
}
|
||||
|
||||
class E<T> {
|
||||
constructor(public x = this) { }
|
||||
class C {
|
||||
constructor(x = this) { }
|
||||
}
|
||||
|
||||
class D<T> {
|
||||
constructor(x = this) { }
|
||||
}
|
||||
|
||||
class E<T> {
|
||||
constructor(public x = this) { }
|
||||
}
|
|
@ -1,20 +1,20 @@
|
|||
class C {
|
||||
constructor(x);
|
||||
constructor(x = 1) {
|
||||
var y = x;
|
||||
}
|
||||
}
|
||||
|
||||
class D<T> {
|
||||
constructor(x);
|
||||
constructor(x:T = null) {
|
||||
var y = x;
|
||||
}
|
||||
}
|
||||
|
||||
class E<T extends Date> {
|
||||
constructor(x);
|
||||
constructor(x: T = null) {
|
||||
var y = x;
|
||||
}
|
||||
class C {
|
||||
constructor(x);
|
||||
constructor(x = 1) {
|
||||
var y = x;
|
||||
}
|
||||
}
|
||||
|
||||
class D<T> {
|
||||
constructor(x);
|
||||
constructor(x:T = null) {
|
||||
var y = x;
|
||||
}
|
||||
}
|
||||
|
||||
class E<T extends Date> {
|
||||
constructor(x);
|
||||
constructor(x: T = null) {
|
||||
var y = x;
|
||||
}
|
||||
}
|
|
@ -1,20 +1,20 @@
|
|||
class C {
|
||||
constructor(x);
|
||||
constructor(public x: string = 1) {
|
||||
var y = x;
|
||||
}
|
||||
}
|
||||
|
||||
class D<T, U> {
|
||||
constructor(x: T, y: U);
|
||||
constructor(x: T = 1, public y: U = x) {
|
||||
var z = x;
|
||||
}
|
||||
}
|
||||
|
||||
class E<T extends Date> {
|
||||
constructor(x);
|
||||
constructor(x: T = new Date()) {
|
||||
var y = x;
|
||||
}
|
||||
class C {
|
||||
constructor(x);
|
||||
constructor(public x: string = 1) {
|
||||
var y = x;
|
||||
}
|
||||
}
|
||||
|
||||
class D<T, U> {
|
||||
constructor(x: T, y: U);
|
||||
constructor(x: T = 1, public y: U = x) {
|
||||
var z = x;
|
||||
}
|
||||
}
|
||||
|
||||
class E<T extends Date> {
|
||||
constructor(x);
|
||||
constructor(x: T = new Date()) {
|
||||
var y = x;
|
||||
}
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
class C {
|
||||
foo: string;
|
||||
constructor(x = 1);
|
||||
constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
class D<T> {
|
||||
foo: string;
|
||||
constructor(x = 1);
|
||||
constructor() {
|
||||
}
|
||||
class C {
|
||||
foo: string;
|
||||
constructor(x = 1);
|
||||
constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
class D<T> {
|
||||
foo: string;
|
||||
constructor(x = 1);
|
||||
constructor() {
|
||||
}
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
class C {
|
||||
foo: string;
|
||||
constructor(x?, y?: any[]);
|
||||
constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
class D<T> {
|
||||
foo: string;
|
||||
constructor(x?, y?: any[]);
|
||||
constructor() {
|
||||
}
|
||||
class C {
|
||||
foo: string;
|
||||
constructor(x?, y?: any[]);
|
||||
constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
class D<T> {
|
||||
foo: string;
|
||||
constructor(x?, y?: any[]);
|
||||
constructor() {
|
||||
}
|
||||
}
|
|
@ -1,20 +1,20 @@
|
|||
class C {
|
||||
y: string;
|
||||
constructor(private x: string, protected z: string) { }
|
||||
}
|
||||
|
||||
var c: C;
|
||||
var r = c.y;
|
||||
var r2 = c.x; // error
|
||||
var r3 = c.z; // error
|
||||
|
||||
class D<T> {
|
||||
y: T;
|
||||
constructor(a: T, private x: T, protected z: T) { }
|
||||
}
|
||||
|
||||
var d: D<string>;
|
||||
var r = d.y;
|
||||
var r2 = d.x; // error
|
||||
var r3 = d.a; // error
|
||||
var r4 = d.z; // error
|
||||
class C {
|
||||
y: string;
|
||||
constructor(private x: string, protected z: string) { }
|
||||
}
|
||||
|
||||
var c: C;
|
||||
var r = c.y;
|
||||
var r2 = c.x; // error
|
||||
var r3 = c.z; // error
|
||||
|
||||
class D<T> {
|
||||
y: T;
|
||||
constructor(a: T, private x: T, protected z: T) { }
|
||||
}
|
||||
|
||||
var d: D<string>;
|
||||
var r = d.y;
|
||||
var r2 = d.x; // error
|
||||
var r3 = d.a; // error
|
||||
var r4 = d.z; // error
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
class C {
|
||||
y: number;
|
||||
constructor(y: number) { } // ok
|
||||
}
|
||||
|
||||
var c: C;
|
||||
var r = c.y;
|
||||
|
||||
class D {
|
||||
y: number;
|
||||
constructor(public y: number) { }
|
||||
}
|
||||
|
||||
var d: D;
|
||||
var r2 = d.y;
|
||||
|
||||
class E {
|
||||
y: number;
|
||||
constructor(private y: number) { }
|
||||
}
|
||||
|
||||
var e: E;
|
||||
var r3 = e.y; // error
|
||||
|
||||
class F {
|
||||
y: number;
|
||||
constructor(protected y: number) { }
|
||||
}
|
||||
|
||||
var f: F;
|
||||
var r4 = f.y; // error
|
||||
class C {
|
||||
y: number;
|
||||
constructor(y: number) { } // ok
|
||||
}
|
||||
|
||||
var c: C;
|
||||
var r = c.y;
|
||||
|
||||
class D {
|
||||
y: number;
|
||||
constructor(public y: number) { }
|
||||
}
|
||||
|
||||
var d: D;
|
||||
var r2 = d.y;
|
||||
|
||||
class E {
|
||||
y: number;
|
||||
constructor(private y: number) { }
|
||||
}
|
||||
|
||||
var e: E;
|
||||
var r3 = e.y; // error
|
||||
|
||||
class F {
|
||||
y: number;
|
||||
constructor(protected y: number) { }
|
||||
}
|
||||
|
||||
var f: F;
|
||||
var r4 = f.y; // error
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// @declaration: true
|
||||
|
||||
class C {
|
||||
constructor(readonly x: number) {}
|
||||
// @declaration: true
|
||||
|
||||
class C {
|
||||
constructor(readonly x: number) {}
|
||||
}
|
|
@ -1,38 +1,38 @@
|
|||
// Tests that readonly parameter properties behave like regular readonly properties
|
||||
|
||||
class A {
|
||||
constructor(readonly x: number) {
|
||||
this.x = 0;
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
constructor(x: number) {
|
||||
super(x);
|
||||
// Fails, x is readonly
|
||||
this.x = 1;
|
||||
}
|
||||
}
|
||||
|
||||
class C extends A {
|
||||
// This is the usual behavior of readonly properties:
|
||||
// if one is redeclared in a base class, then it can be assigned to.
|
||||
constructor(readonly x: number) {
|
||||
super(x);
|
||||
this.x = 1;
|
||||
}
|
||||
}
|
||||
|
||||
class D {
|
||||
constructor(private readonly x: number) {
|
||||
this.x = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Fails, can't redeclare readonly property
|
||||
class E extends D {
|
||||
constructor(readonly x: number) {
|
||||
super(x);
|
||||
this.x = 1;
|
||||
}
|
||||
}
|
||||
// Tests that readonly parameter properties behave like regular readonly properties
|
||||
|
||||
class A {
|
||||
constructor(readonly x: number) {
|
||||
this.x = 0;
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
constructor(x: number) {
|
||||
super(x);
|
||||
// Fails, x is readonly
|
||||
this.x = 1;
|
||||
}
|
||||
}
|
||||
|
||||
class C extends A {
|
||||
// This is the usual behavior of readonly properties:
|
||||
// if one is redeclared in a base class, then it can be assigned to.
|
||||
constructor(readonly x: number) {
|
||||
super(x);
|
||||
this.x = 1;
|
||||
}
|
||||
}
|
||||
|
||||
class D {
|
||||
constructor(private readonly x: number) {
|
||||
this.x = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Fails, can't redeclare readonly property
|
||||
class E extends D {
|
||||
constructor(readonly x: number) {
|
||||
super(x);
|
||||
this.x = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
class C {
|
||||
constructor(readonly x: number) {}
|
||||
}
|
||||
new C(1).x = 2;
|
||||
|
||||
class E {
|
||||
constructor(readonly public x: number) {}
|
||||
}
|
||||
|
||||
class F {
|
||||
constructor(private readonly x: number) {}
|
||||
}
|
||||
class C {
|
||||
constructor(readonly x: number) {}
|
||||
}
|
||||
new C(1).x = 2;
|
||||
|
||||
class E {
|
||||
constructor(readonly public x: number) {}
|
||||
}
|
||||
|
||||
class F {
|
||||
constructor(private readonly x: number) {}
|
||||
}
|
||||
new F(1).x;
|
|
@ -1,4 +1,4 @@
|
|||
class C {
|
||||
readonly readonly x: number;
|
||||
constructor(readonly readonly y: number) {}
|
||||
class C {
|
||||
readonly readonly x: number;
|
||||
constructor(readonly readonly y: number) {}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue