mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
This commit is contained in:
+5
-11
@@ -8328,7 +8328,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
return factory.createStringLiteral(name, !!singleQuote);
|
||||
}
|
||||
if (isNumericLiteralName(name) && startsWith(name, "-")) {
|
||||
return factory.createComputedPropertyName(factory.createPrefixUnaryExpression(SyntaxKind.MinusToken, factory.createNumericLiteral(Math.abs(+name))));
|
||||
return factory.createComputedPropertyName(factory.createNumericLiteral(+name));
|
||||
}
|
||||
return createPropertyNameNodeForIdentifierOrLiteral(name, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod);
|
||||
}
|
||||
@@ -39006,14 +39006,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
return hasSkipDirectInferenceFlag(node) ?
|
||||
blockedStringType :
|
||||
getFreshTypeOfLiteralType(getStringLiteralType((node as StringLiteralLike).text));
|
||||
case SyntaxKind.NumericLiteral: {
|
||||
case SyntaxKind.NumericLiteral:
|
||||
checkGrammarNumericLiteral(node as NumericLiteral);
|
||||
const value = +(node as NumericLiteral).text;
|
||||
if (!isFinite(value)) {
|
||||
return numberType;
|
||||
}
|
||||
return getFreshTypeOfLiteralType(getNumberLiteralType(value));
|
||||
}
|
||||
return getFreshTypeOfLiteralType(getNumberLiteralType(+(node as NumericLiteral).text));
|
||||
case SyntaxKind.BigIntLiteral:
|
||||
checkGrammarBigIntLiteral(node as BigIntLiteral);
|
||||
return getFreshTypeOfLiteralType(getBigIntLiteralType({
|
||||
@@ -47949,9 +47944,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
if (enumResult) return enumResult;
|
||||
const literalValue = (type as LiteralType).value;
|
||||
return typeof literalValue === "object" ? factory.createBigIntLiteral(literalValue) :
|
||||
typeof literalValue === "string" ? factory.createStringLiteral(literalValue) :
|
||||
literalValue < 0 ? factory.createPrefixUnaryExpression(SyntaxKind.MinusToken, factory.createNumericLiteral(Math.abs(literalValue))) :
|
||||
factory.createNumericLiteral(literalValue);
|
||||
typeof literalValue === "number" ? factory.createNumericLiteral(literalValue) :
|
||||
factory.createStringLiteral(literalValue);
|
||||
}
|
||||
|
||||
function createLiteralConstValue(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration, tracker: SymbolTracker) {
|
||||
|
||||
@@ -44,7 +44,6 @@ import {
|
||||
CaseOrDefaultClause,
|
||||
cast,
|
||||
CatchClause,
|
||||
CharacterCodes,
|
||||
ClassDeclaration,
|
||||
ClassElement,
|
||||
ClassExpression,
|
||||
@@ -1254,10 +1253,8 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode
|
||||
|
||||
// @api
|
||||
function createNumericLiteral(value: string | number, numericLiteralFlags: TokenFlags = TokenFlags.None): NumericLiteral {
|
||||
const text = typeof value === "number" ? value + "" : value;
|
||||
Debug.assert(text.charCodeAt(0) !== CharacterCodes.minus, "Negative numbers should be created in combination with createPrefixUnaryExpression");
|
||||
const node = createBaseDeclaration<NumericLiteral>(SyntaxKind.NumericLiteral);
|
||||
node.text = text;
|
||||
node.text = typeof value === "number" ? value + "" : value;
|
||||
node.numericLiteralFlags = numericLiteralFlags;
|
||||
if (numericLiteralFlags & TokenFlags.BinaryOrOctalSpecifier) node.transformFlags |= TransformFlags.ContainsES2015;
|
||||
return node;
|
||||
|
||||
@@ -1798,14 +1798,7 @@ export function transformDeclarations(context: TransformationContext) {
|
||||
if (shouldStripInternal(m)) return;
|
||||
// Rewrite enum values to their constants, if available
|
||||
const constValue = resolver.getConstantValue(m);
|
||||
const newInitializer = constValue === undefined
|
||||
? undefined
|
||||
: typeof constValue === "string"
|
||||
? factory.createStringLiteral(constValue)
|
||||
: constValue < 0
|
||||
? factory.createPrefixUnaryExpression(SyntaxKind.MinusToken, factory.createNumericLiteral(Math.abs(constValue)))
|
||||
: factory.createNumericLiteral(constValue);
|
||||
return preserveJsDoc(factory.updateEnumMember(m, m.name, newInitializer), m);
|
||||
return preserveJsDoc(factory.updateEnumMember(m, m.name, constValue !== undefined ? typeof constValue === "string" ? factory.createStringLiteral(constValue) : factory.createNumericLiteral(constValue) : undefined), m);
|
||||
})),
|
||||
));
|
||||
}
|
||||
|
||||
@@ -2524,7 +2524,7 @@ export function transformGenerators(context: TransformationContext): (x: SourceF
|
||||
labelExpressions = [];
|
||||
}
|
||||
|
||||
const expression = factory.createNumericLiteral(Number.MAX_SAFE_INTEGER);
|
||||
const expression = factory.createNumericLiteral(-1);
|
||||
if (labelExpressions[label] === undefined) {
|
||||
labelExpressions[label] = [expression];
|
||||
}
|
||||
|
||||
@@ -1901,9 +1901,7 @@ export function transformTypeScript(context: TransformationContext) {
|
||||
function transformEnumMemberDeclarationValue(member: EnumMember): Expression {
|
||||
const value = resolver.getConstantValue(member);
|
||||
if (value !== undefined) {
|
||||
return typeof value === "string" ? factory.createStringLiteral(value) :
|
||||
value < 0 ? factory.createPrefixUnaryExpression(SyntaxKind.MinusToken, factory.createNumericLiteral(Math.abs(value))) :
|
||||
factory.createNumericLiteral(value);
|
||||
return typeof value === "string" ? factory.createStringLiteral(value) : factory.createNumericLiteral(value);
|
||||
}
|
||||
else {
|
||||
enableSubstitutionForNonQualifiedEnumMembers();
|
||||
|
||||
@@ -15,7 +15,7 @@ var bin3 = 0B1111111111111111111111111111111111111111111111110100101010000001011
|
||||
|
||||
var bin4 = 0B111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101001010100000010111110001111111111;
|
||||
>bin4 : number
|
||||
>0B111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101001010100000010111110001111111111 : number
|
||||
>0B111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101001010100000010111110001111111111 : Infinity
|
||||
|
||||
var obj1 = {
|
||||
>obj1 : { 26: string; a: number; bin1: number; b: number; Infinity: boolean; }
|
||||
|
||||
@@ -15,7 +15,7 @@ var bin3 = 0B1111111111111111111111111111111111111111111111110100101010000001011
|
||||
|
||||
var bin4 = 0B111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101001010100000010111110001111111111;
|
||||
>bin4 : number
|
||||
>0B111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101001010100000010111110001111111111 : number
|
||||
>0B111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101001010100000010111110001111111111 : Infinity
|
||||
|
||||
var obj1 = {
|
||||
>obj1 : { 26: string; a: number; bin1: number; b: number; Infinity: boolean; }
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
fakeInfinity1.ts(17,1): error TS2322: Type 'number' is not assignable to type 'Infinity'.
|
||||
|
||||
|
||||
==== fakeInfinity1.ts (1 errors) ====
|
||||
// These are not actually the real infinity.
|
||||
export type PositiveInfinity = 1e999;
|
||||
export type NegativeInfinity = -1e999;
|
||||
|
||||
export type TypeOfInfinity = typeof Infinity;
|
||||
export type TypeOfNaN = typeof NaN;
|
||||
|
||||
type A = 1e999;
|
||||
type B = 1e9999;
|
||||
|
||||
declare let a: A;
|
||||
declare let b: B;
|
||||
|
||||
a = b;
|
||||
b = a;
|
||||
|
||||
a = Infinity;
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'Infinity'.
|
||||
a = 1e999;
|
||||
a = 1e9999;
|
||||
|
||||
export type Oops = 123456789123456789123456789123456789123456789123456789;
|
||||
export const oops = 123456789123456789123456789123456789123456789123456789;
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
//// [tests/cases/compiler/fakeInfinity1.ts] ////
|
||||
|
||||
//// [fakeInfinity1.ts]
|
||||
// These are not actually the real infinity.
|
||||
export type PositiveInfinity = 1e999;
|
||||
export type NegativeInfinity = -1e999;
|
||||
|
||||
export type TypeOfInfinity = typeof Infinity;
|
||||
export type TypeOfNaN = typeof NaN;
|
||||
|
||||
type A = 1e999;
|
||||
type B = 1e9999;
|
||||
|
||||
declare let a: A;
|
||||
declare let b: B;
|
||||
|
||||
a = b;
|
||||
b = a;
|
||||
|
||||
a = Infinity;
|
||||
a = 1e999;
|
||||
a = 1e9999;
|
||||
|
||||
export type Oops = 123456789123456789123456789123456789123456789123456789;
|
||||
export const oops = 123456789123456789123456789123456789123456789123456789;
|
||||
|
||||
|
||||
//// [fakeInfinity1.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.oops = void 0;
|
||||
a = b;
|
||||
b = a;
|
||||
a = Infinity;
|
||||
a = 1e999;
|
||||
a = 1e9999;
|
||||
exports.oops = 123456789123456789123456789123456789123456789123456789;
|
||||
|
||||
|
||||
//// [fakeInfinity1.d.ts]
|
||||
export type PositiveInfinity = 1e999;
|
||||
export type NegativeInfinity = -1e999;
|
||||
export type TypeOfInfinity = typeof Infinity;
|
||||
export type TypeOfNaN = typeof NaN;
|
||||
export type Oops = 123456789123456789123456789123456789123456789123456789;
|
||||
export declare const oops = 1.2345678912345678e+53;
|
||||
@@ -0,0 +1,56 @@
|
||||
//// [tests/cases/compiler/fakeInfinity1.ts] ////
|
||||
|
||||
=== fakeInfinity1.ts ===
|
||||
// These are not actually the real infinity.
|
||||
export type PositiveInfinity = 1e999;
|
||||
>PositiveInfinity : Symbol(PositiveInfinity, Decl(fakeInfinity1.ts, 0, 0))
|
||||
|
||||
export type NegativeInfinity = -1e999;
|
||||
>NegativeInfinity : Symbol(NegativeInfinity, Decl(fakeInfinity1.ts, 1, 37))
|
||||
|
||||
export type TypeOfInfinity = typeof Infinity;
|
||||
>TypeOfInfinity : Symbol(TypeOfInfinity, Decl(fakeInfinity1.ts, 2, 38))
|
||||
>Infinity : Symbol(Infinity, Decl(lib.es5.d.ts, --, --))
|
||||
|
||||
export type TypeOfNaN = typeof NaN;
|
||||
>TypeOfNaN : Symbol(TypeOfNaN, Decl(fakeInfinity1.ts, 4, 45))
|
||||
>NaN : Symbol(NaN, Decl(lib.es5.d.ts, --, --))
|
||||
|
||||
type A = 1e999;
|
||||
>A : Symbol(A, Decl(fakeInfinity1.ts, 5, 35))
|
||||
|
||||
type B = 1e9999;
|
||||
>B : Symbol(B, Decl(fakeInfinity1.ts, 7, 15))
|
||||
|
||||
declare let a: A;
|
||||
>a : Symbol(a, Decl(fakeInfinity1.ts, 10, 11))
|
||||
>A : Symbol(A, Decl(fakeInfinity1.ts, 5, 35))
|
||||
|
||||
declare let b: B;
|
||||
>b : Symbol(b, Decl(fakeInfinity1.ts, 11, 11))
|
||||
>B : Symbol(B, Decl(fakeInfinity1.ts, 7, 15))
|
||||
|
||||
a = b;
|
||||
>a : Symbol(a, Decl(fakeInfinity1.ts, 10, 11))
|
||||
>b : Symbol(b, Decl(fakeInfinity1.ts, 11, 11))
|
||||
|
||||
b = a;
|
||||
>b : Symbol(b, Decl(fakeInfinity1.ts, 11, 11))
|
||||
>a : Symbol(a, Decl(fakeInfinity1.ts, 10, 11))
|
||||
|
||||
a = Infinity;
|
||||
>a : Symbol(a, Decl(fakeInfinity1.ts, 10, 11))
|
||||
>Infinity : Symbol(Infinity, Decl(lib.es5.d.ts, --, --))
|
||||
|
||||
a = 1e999;
|
||||
>a : Symbol(a, Decl(fakeInfinity1.ts, 10, 11))
|
||||
|
||||
a = 1e9999;
|
||||
>a : Symbol(a, Decl(fakeInfinity1.ts, 10, 11))
|
||||
|
||||
export type Oops = 123456789123456789123456789123456789123456789123456789;
|
||||
>Oops : Symbol(Oops, Decl(fakeInfinity1.ts, 18, 11))
|
||||
|
||||
export const oops = 123456789123456789123456789123456789123456789123456789;
|
||||
>oops : Symbol(oops, Decl(fakeInfinity1.ts, 21, 12))
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
//// [tests/cases/compiler/fakeInfinity1.ts] ////
|
||||
|
||||
=== fakeInfinity1.ts ===
|
||||
// These are not actually the real infinity.
|
||||
export type PositiveInfinity = 1e999;
|
||||
>PositiveInfinity : Infinity
|
||||
|
||||
export type NegativeInfinity = -1e999;
|
||||
>NegativeInfinity : -Infinity
|
||||
>-1e999 : -Infinity
|
||||
>1e999 : Infinity
|
||||
|
||||
export type TypeOfInfinity = typeof Infinity;
|
||||
>TypeOfInfinity : number
|
||||
>Infinity : number
|
||||
|
||||
export type TypeOfNaN = typeof NaN;
|
||||
>TypeOfNaN : number
|
||||
>NaN : number
|
||||
|
||||
type A = 1e999;
|
||||
>A : Infinity
|
||||
|
||||
type B = 1e9999;
|
||||
>B : Infinity
|
||||
|
||||
declare let a: A;
|
||||
>a : Infinity
|
||||
|
||||
declare let b: B;
|
||||
>b : Infinity
|
||||
|
||||
a = b;
|
||||
>a = b : Infinity
|
||||
>a : Infinity
|
||||
>b : Infinity
|
||||
|
||||
b = a;
|
||||
>b = a : Infinity
|
||||
>b : Infinity
|
||||
>a : Infinity
|
||||
|
||||
a = Infinity;
|
||||
>a = Infinity : number
|
||||
>a : Infinity
|
||||
>Infinity : number
|
||||
|
||||
a = 1e999;
|
||||
>a = 1e999 : Infinity
|
||||
>a : Infinity
|
||||
>1e999 : Infinity
|
||||
|
||||
a = 1e9999;
|
||||
>a = 1e9999 : Infinity
|
||||
>a : Infinity
|
||||
>1e9999 : Infinity
|
||||
|
||||
export type Oops = 123456789123456789123456789123456789123456789123456789;
|
||||
>Oops : 1.2345678912345678e+53
|
||||
|
||||
export const oops = 123456789123456789123456789123456789123456789123456789;
|
||||
>oops : 1.2345678912345678e+53
|
||||
>123456789123456789123456789123456789123456789123456789 : 1.2345678912345678e+53
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
//// [tests/cases/compiler/fakeInfinity2.ts] ////
|
||||
|
||||
//// [fakeInfinity2.ts]
|
||||
export enum Foo {
|
||||
A = 1e999,
|
||||
B = -1e999,
|
||||
}
|
||||
|
||||
namespace X {
|
||||
type A = 1e999;
|
||||
type B = 2e999;
|
||||
|
||||
export function f(): A {
|
||||
throw new Error()
|
||||
}
|
||||
}
|
||||
|
||||
export const m = X.f();
|
||||
|
||||
|
||||
//// [fakeInfinity2.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.m = exports.Foo = void 0;
|
||||
var Foo;
|
||||
(function (Foo) {
|
||||
Foo[Foo["A"] = Infinity] = "A";
|
||||
Foo[Foo["B"] = -Infinity] = "B";
|
||||
})(Foo || (exports.Foo = Foo = {}));
|
||||
var X;
|
||||
(function (X) {
|
||||
function f() {
|
||||
throw new Error();
|
||||
}
|
||||
X.f = f;
|
||||
})(X || (X = {}));
|
||||
exports.m = X.f();
|
||||
|
||||
|
||||
//// [fakeInfinity2.d.ts]
|
||||
export declare enum Foo {
|
||||
A = Infinity,
|
||||
B = -Infinity
|
||||
}
|
||||
export declare const m: Infinity;
|
||||
|
||||
|
||||
//// [DtsFileErrors]
|
||||
|
||||
|
||||
fakeInfinity2.d.ts(5,25): error TS2749: 'Infinity' refers to a value, but is being used as a type here. Did you mean 'typeof Infinity'?
|
||||
|
||||
|
||||
==== fakeInfinity2.d.ts (1 errors) ====
|
||||
export declare enum Foo {
|
||||
A = Infinity,
|
||||
B = -Infinity
|
||||
}
|
||||
export declare const m: Infinity;
|
||||
~~~~~~~~
|
||||
!!! error TS2749: 'Infinity' refers to a value, but is being used as a type here. Did you mean 'typeof Infinity'?
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
//// [tests/cases/compiler/fakeInfinity2.ts] ////
|
||||
|
||||
=== fakeInfinity2.ts ===
|
||||
export enum Foo {
|
||||
>Foo : Symbol(Foo, Decl(fakeInfinity2.ts, 0, 0))
|
||||
|
||||
A = 1e999,
|
||||
>A : Symbol(Foo.A, Decl(fakeInfinity2.ts, 0, 17))
|
||||
|
||||
B = -1e999,
|
||||
>B : Symbol(Foo.B, Decl(fakeInfinity2.ts, 1, 14))
|
||||
}
|
||||
|
||||
namespace X {
|
||||
>X : Symbol(X, Decl(fakeInfinity2.ts, 3, 1))
|
||||
|
||||
type A = 1e999;
|
||||
>A : Symbol(A, Decl(fakeInfinity2.ts, 5, 13))
|
||||
|
||||
type B = 2e999;
|
||||
>B : Symbol(B, Decl(fakeInfinity2.ts, 6, 19))
|
||||
|
||||
export function f(): A {
|
||||
>f : Symbol(f, Decl(fakeInfinity2.ts, 7, 19))
|
||||
>A : Symbol(A, Decl(fakeInfinity2.ts, 5, 13))
|
||||
|
||||
throw new Error()
|
||||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
}
|
||||
}
|
||||
|
||||
export const m = X.f();
|
||||
>m : Symbol(m, Decl(fakeInfinity2.ts, 14, 12))
|
||||
>X.f : Symbol(X.f, Decl(fakeInfinity2.ts, 7, 19))
|
||||
>X : Symbol(X, Decl(fakeInfinity2.ts, 3, 1))
|
||||
>f : Symbol(X.f, Decl(fakeInfinity2.ts, 7, 19))
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
//// [tests/cases/compiler/fakeInfinity2.ts] ////
|
||||
|
||||
=== fakeInfinity2.ts ===
|
||||
export enum Foo {
|
||||
>Foo : Foo
|
||||
|
||||
A = 1e999,
|
||||
>A : Foo.A
|
||||
>1e999 : Infinity
|
||||
|
||||
B = -1e999,
|
||||
>B : Foo.B
|
||||
>-1e999 : -Infinity
|
||||
>1e999 : Infinity
|
||||
}
|
||||
|
||||
namespace X {
|
||||
>X : typeof X
|
||||
|
||||
type A = 1e999;
|
||||
>A : Infinity
|
||||
|
||||
type B = 2e999;
|
||||
>B : Infinity
|
||||
|
||||
export function f(): A {
|
||||
>f : () => Infinity
|
||||
|
||||
throw new Error()
|
||||
>new Error() : Error
|
||||
>Error : ErrorConstructor
|
||||
}
|
||||
}
|
||||
|
||||
export const m = X.f();
|
||||
>m : Infinity
|
||||
>X.f() : Infinity
|
||||
>X.f : () => Infinity
|
||||
>X : typeof X
|
||||
>f : () => Infinity
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
//// [tests/cases/compiler/fakeInfinity3.ts] ////
|
||||
|
||||
//// [fakeInfinity3.ts]
|
||||
export enum Foo {
|
||||
A = 1e999,
|
||||
B = -1e999,
|
||||
}
|
||||
|
||||
namespace X {
|
||||
type A = 1e999;
|
||||
type B = 2e999;
|
||||
|
||||
export function f(): A {
|
||||
throw new Error()
|
||||
}
|
||||
}
|
||||
|
||||
export const m = X.f();
|
||||
|
||||
export const Infinity = "oops";
|
||||
|
||||
|
||||
//// [fakeInfinity3.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Infinity = exports.m = exports.Foo = void 0;
|
||||
var Foo;
|
||||
(function (Foo) {
|
||||
Foo[Foo["A"] = Infinity] = "A";
|
||||
Foo[Foo["B"] = -Infinity] = "B";
|
||||
})(Foo || (exports.Foo = Foo = {}));
|
||||
var X;
|
||||
(function (X) {
|
||||
function f() {
|
||||
throw new Error();
|
||||
}
|
||||
X.f = f;
|
||||
})(X || (X = {}));
|
||||
exports.m = X.f();
|
||||
exports.Infinity = "oops";
|
||||
|
||||
|
||||
//// [fakeInfinity3.d.ts]
|
||||
export declare enum Foo {
|
||||
A = Infinity,
|
||||
B = -Infinity
|
||||
}
|
||||
export declare const m: Infinity;
|
||||
export declare const Infinity = "oops";
|
||||
|
||||
|
||||
//// [DtsFileErrors]
|
||||
|
||||
|
||||
fakeInfinity3.d.ts(3,9): error TS1066: In ambient enum declarations member initializer must be constant expression.
|
||||
fakeInfinity3.d.ts(5,25): error TS2749: 'Infinity' refers to a value, but is being used as a type here. Did you mean 'typeof Infinity'?
|
||||
|
||||
|
||||
==== fakeInfinity3.d.ts (2 errors) ====
|
||||
export declare enum Foo {
|
||||
A = Infinity,
|
||||
B = -Infinity
|
||||
~~~~~~~~~
|
||||
!!! error TS1066: In ambient enum declarations member initializer must be constant expression.
|
||||
}
|
||||
export declare const m: Infinity;
|
||||
~~~~~~~~
|
||||
!!! error TS2749: 'Infinity' refers to a value, but is being used as a type here. Did you mean 'typeof Infinity'?
|
||||
export declare const Infinity = "oops";
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
//// [tests/cases/compiler/fakeInfinity3.ts] ////
|
||||
|
||||
=== fakeInfinity3.ts ===
|
||||
export enum Foo {
|
||||
>Foo : Symbol(Foo, Decl(fakeInfinity3.ts, 0, 0))
|
||||
|
||||
A = 1e999,
|
||||
>A : Symbol(Foo.A, Decl(fakeInfinity3.ts, 0, 17))
|
||||
|
||||
B = -1e999,
|
||||
>B : Symbol(Foo.B, Decl(fakeInfinity3.ts, 1, 14))
|
||||
}
|
||||
|
||||
namespace X {
|
||||
>X : Symbol(X, Decl(fakeInfinity3.ts, 3, 1))
|
||||
|
||||
type A = 1e999;
|
||||
>A : Symbol(A, Decl(fakeInfinity3.ts, 5, 13))
|
||||
|
||||
type B = 2e999;
|
||||
>B : Symbol(B, Decl(fakeInfinity3.ts, 6, 19))
|
||||
|
||||
export function f(): A {
|
||||
>f : Symbol(f, Decl(fakeInfinity3.ts, 7, 19))
|
||||
>A : Symbol(A, Decl(fakeInfinity3.ts, 5, 13))
|
||||
|
||||
throw new Error()
|
||||
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
|
||||
}
|
||||
}
|
||||
|
||||
export const m = X.f();
|
||||
>m : Symbol(m, Decl(fakeInfinity3.ts, 14, 12))
|
||||
>X.f : Symbol(X.f, Decl(fakeInfinity3.ts, 7, 19))
|
||||
>X : Symbol(X, Decl(fakeInfinity3.ts, 3, 1))
|
||||
>f : Symbol(X.f, Decl(fakeInfinity3.ts, 7, 19))
|
||||
|
||||
export const Infinity = "oops";
|
||||
>Infinity : Symbol(Infinity, Decl(fakeInfinity3.ts, 16, 12))
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
//// [tests/cases/compiler/fakeInfinity3.ts] ////
|
||||
|
||||
=== fakeInfinity3.ts ===
|
||||
export enum Foo {
|
||||
>Foo : Foo
|
||||
|
||||
A = 1e999,
|
||||
>A : Foo.A
|
||||
>1e999 : Infinity
|
||||
|
||||
B = -1e999,
|
||||
>B : Foo.B
|
||||
>-1e999 : -Infinity
|
||||
>1e999 : Infinity
|
||||
}
|
||||
|
||||
namespace X {
|
||||
>X : typeof X
|
||||
|
||||
type A = 1e999;
|
||||
>A : Infinity
|
||||
|
||||
type B = 2e999;
|
||||
>B : Infinity
|
||||
|
||||
export function f(): A {
|
||||
>f : () => Infinity
|
||||
|
||||
throw new Error()
|
||||
>new Error() : Error
|
||||
>Error : ErrorConstructor
|
||||
}
|
||||
}
|
||||
|
||||
export const m = X.f();
|
||||
>m : Infinity
|
||||
>X.f() : Infinity
|
||||
>X.f : () => Infinity
|
||||
>X : typeof X
|
||||
>f : () => Infinity
|
||||
|
||||
export const Infinity = "oops";
|
||||
>Infinity : "oops"
|
||||
>"oops" : "oops"
|
||||
|
||||
@@ -11,7 +11,7 @@ var oct2 = 0O45436;
|
||||
|
||||
var oct3 = 0o7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777;
|
||||
>oct3 : number
|
||||
>0o7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 : number
|
||||
>0o7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 : Infinity
|
||||
|
||||
var oct4 = 0o7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777;
|
||||
>oct4 : number
|
||||
|
||||
@@ -11,7 +11,7 @@ var oct2 = 0O45436;
|
||||
|
||||
var oct3 = 0o7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777;
|
||||
>oct3 : number
|
||||
>0o7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 : number
|
||||
>0o7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 : Infinity
|
||||
|
||||
var oct4 = 0o7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777;
|
||||
>oct4 : number
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
// @strict: true
|
||||
// @declaration: true
|
||||
|
||||
// These are not actually the real infinity.
|
||||
export type PositiveInfinity = 1e999;
|
||||
export type NegativeInfinity = -1e999;
|
||||
|
||||
export type TypeOfInfinity = typeof Infinity;
|
||||
export type TypeOfNaN = typeof NaN;
|
||||
|
||||
type A = 1e999;
|
||||
type B = 1e9999;
|
||||
|
||||
declare let a: A;
|
||||
declare let b: B;
|
||||
|
||||
a = b;
|
||||
b = a;
|
||||
|
||||
a = Infinity;
|
||||
a = 1e999;
|
||||
a = 1e9999;
|
||||
|
||||
export type Oops = 123456789123456789123456789123456789123456789123456789;
|
||||
export const oops = 123456789123456789123456789123456789123456789123456789;
|
||||
@@ -0,0 +1,18 @@
|
||||
// @strict: true
|
||||
// @declaration: true
|
||||
|
||||
export enum Foo {
|
||||
A = 1e999,
|
||||
B = -1e999,
|
||||
}
|
||||
|
||||
namespace X {
|
||||
type A = 1e999;
|
||||
type B = 2e999;
|
||||
|
||||
export function f(): A {
|
||||
throw new Error()
|
||||
}
|
||||
}
|
||||
|
||||
export const m = X.f();
|
||||
@@ -0,0 +1,20 @@
|
||||
// @strict: true
|
||||
// @declaration: true
|
||||
|
||||
export enum Foo {
|
||||
A = 1e999,
|
||||
B = -1e999,
|
||||
}
|
||||
|
||||
namespace X {
|
||||
type A = 1e999;
|
||||
type B = 2e999;
|
||||
|
||||
export function f(): A {
|
||||
throw new Error()
|
||||
}
|
||||
}
|
||||
|
||||
export const m = X.f();
|
||||
|
||||
export const Infinity = "oops";
|
||||
Reference in New Issue
Block a user