1//is not strict mode
2let endedCoord: {x: number, y: number} = {
3 x: -1,
4 y: -1,
5}
1declare function create(o: object | null): void;
2// OKcreate({ prop: 0 });create(null);create(undefined); // with `--strictNullChecks` flag enabled, undefined is not a subtype of nullArgument of type 'undefined' is not assignable to parameter of type 'object | null'.2345Argument of type 'undefined' is not assignable to parameter of type 'object | null'.
3create(42);Argument of type '42' is not assignable to parameter of type 'object | null'.2345Argument of type '42' is not assignable to parameter of type 'object | null'.create("string");Argument of type '"string"' is not assignable to parameter of type 'object | null'.2345Argument of type '"string"' is not assignable to parameter of type 'object | null'.create(false);Argument of type 'false' is not assignable to parameter of type 'object | null'.2345Argument of type 'false' is not assignable to parameter of type 'object | null'.Try
1const data = {
2 value: 123,
3 text: 'text'
4};
5type Data = typeof data["text"]; // String
1ts// 1. Select the div element using the id property
2const app = document.getElementById("app");
3
4// 2. Create a new <p></p> element programmatically
5const p = document.createElement("p");
6
7// 3. Add the text content
8p.textContent = "Hello, World!";
9
10// 4. Append the p element to the div element
11app?.appendChild(p);