/* should not generate diagnostics */

// simple assignments
let bigintOne = 123n;
let bigintTwo: bigint = BigInt(123n);
let five = 5;
const MY_NUMBER = +42;
const foo = 42;
let foo = 42;
let foo = -42;
const foo = 42 as const;
const foo = 42 as number;
const foo = 42 satisfies number;
const foo = (42 satisfies number) as const;
const foo = ((42 satisfies number) as const);
const foo = (42 satisfies number)!;

// jsx
let jsx = (<div>{5}</div>);
let a = <input maxLength={10} />;
let a = <div objectProp={{ test: 1}}></div>;

// destructuring with default values
const {tax = 0.25} = accountancy;
[head = 100] = [];
const { param = 123 } = sourceObject;
const func = (param = 123) => {}
const func = ({ param = 123 }) => {}
const [one = 1, two = 2] = []
let one, two; [one = 1, two = 2] = []

//array access
const foo = [];
foo[6] = "foo";
foo[0]
foo[-0]
foo[1]
foo[100]
foo[200.00]
foo[3e4]
foo[1.23e2]
foo[230e-1]
foo[0b110]
foo[0o71]
foo[0xABC]
foo[0123]
foo[5.0000000000000001]
foo[4294967294]
foo[0n]
foo[-0n]
foo[1n]
foo[100n]
foo[0xABn]
foo[4294967294n]
foo?.[777]
foo[+0]
foo[+1]
foo[+0n]
foo[+1n]

// default parameters
function mapParallel(concurrency = 3) {
}

function mapParallel({concurrency = 5}) {
}

function mapParallel({concurrency: {level = 5}}) {
}

// class with properties
class C { foo = 3; }
class C { foo = -3; }
class C { static foo = 3; }
class C { #foo = 3; }
class C { static #foo = 3; }

// object with properties
const magic = {
	tax: 0.25
};
let foo = { bar: 10 }

// enums
enum E { A = 3}
enum E { A = (4)}
enum E { A = -4}

// typescript types
type SmallPrimes = 2 | 3 | 5 | 7 | 11;
type Baz = Parameters<Foo>[10];
type Foo = Bar[10];

function f(x: 100): bool {
	return true
}

const oneHundred = 100;
function f(x: string): 100 {
	return oneHundred;
}

// bitwise operations
let bitwiseOr = 1 | 42;
let bitwiseAnd = 1 & 42;
let bitwiseXor = 1 ^ 42;

let a = ~5;
let a = -5;

let c = 4;
c &= 4;

// parseInt and JSON.stringify
JSON.stringify(22);
JSON.stringify((-33));
let x = parseInt(y, 10);
let x = parseInt(y, -10);
let x = Number.parseInt(y, 10);
let x = parseInt?.(y, 10);
let x = Number?.parseInt(y, 10);
let x = (Number?.parseInt)(y, 10);

// any Math function with non magic number -1,0, 1, 2 etc
Math.round(1);
Math.pow(1, 10);
Math.abs(-2);
Math.abs(-1);
Math.abs(-1n);

// non magic num
let total = price * 1;
let total = price * 0;
let total = price * (-2);
let total = price * 2;
let total = price ** 2;
let total = price ** 10;
let total = price / 2n;
let total = price % 0;
let foo = 0 + 1 - 2 + -2 + 1n + 2n;

// fn body
setTimeout(function() {return 1;}, 0);

// fn calls
f(1n)
f(-1n)
f(1)
f((-1))

// type predicate
function isFortyTwo(num): num is 42 {
	return true;
}
