mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
83 lines
1.1 KiB
TypeScript
83 lines
1.1 KiB
TypeScript
//// [tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithNumericLiteral.ts] ////
|
|
|
|
//// [comparisonOperatorWithNumericLiteral.ts]
|
|
type BrandedNum = number & { __numberBrand: any };
|
|
var x : BrandedNum;
|
|
|
|
// operator >
|
|
x > 0;
|
|
x > <number>0;
|
|
x > <BrandedNum>0;
|
|
|
|
// operator <
|
|
x < 0;
|
|
x < <number>0;
|
|
x < <BrandedNum>0;
|
|
|
|
// operator >=
|
|
x >= 0;
|
|
x >= <number>0;
|
|
x >= <BrandedNum>0;
|
|
|
|
// operator <=
|
|
x <= 0;
|
|
x <= <number>0;
|
|
x <= <BrandedNum>0;
|
|
|
|
// operator ==
|
|
x == 0;
|
|
x == <number>0;
|
|
x == <BrandedNum>0;
|
|
|
|
// operator !=
|
|
x != 0;
|
|
x != <number>0;
|
|
x != <BrandedNum>0;
|
|
|
|
// operator ===
|
|
x === 0;
|
|
x === <number>0;
|
|
x === <BrandedNum>0;
|
|
|
|
// operator !==
|
|
x !== 0;
|
|
x !== <number>0;
|
|
x !== <BrandedNum>0;
|
|
|
|
|
|
//// [comparisonOperatorWithNumericLiteral.js]
|
|
"use strict";
|
|
var x;
|
|
// operator >
|
|
x > 0;
|
|
x > 0;
|
|
x > 0;
|
|
// operator <
|
|
x < 0;
|
|
x < 0;
|
|
x < 0;
|
|
// operator >=
|
|
x >= 0;
|
|
x >= 0;
|
|
x >= 0;
|
|
// operator <=
|
|
x <= 0;
|
|
x <= 0;
|
|
x <= 0;
|
|
// operator ==
|
|
x == 0;
|
|
x == 0;
|
|
x == 0;
|
|
// operator !=
|
|
x != 0;
|
|
x != 0;
|
|
x != 0;
|
|
// operator ===
|
|
x === 0;
|
|
x === 0;
|
|
x === 0;
|
|
// operator !==
|
|
x !== 0;
|
|
x !== 0;
|
|
x !== 0;
|