mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
40 lines
1.3 KiB
Plaintext
40 lines
1.3 KiB
Plaintext
main.js(24,1): error TS7022: 'y' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
|
|
main.js(29,5): error TS7022: 'y' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
|
|
|
|
|
|
==== main.js (2 errors) ====
|
|
/** @param {Record<string, number>} obj */
|
|
function fx(obj) {}
|
|
|
|
const obj1 = {};
|
|
fx(obj1);
|
|
|
|
const obj2 = {};
|
|
obj2.x = 1
|
|
fx(obj2);
|
|
|
|
function f1() {
|
|
const obj1 = {};
|
|
fx(obj1);
|
|
}
|
|
|
|
function f2() {
|
|
const obj2 = {};
|
|
obj2.x = 1
|
|
fx(obj2);
|
|
}
|
|
|
|
const obj3 = {};
|
|
obj3.x = 1;
|
|
obj3.y = Object.values(obj3); // Circularity error
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS7022: 'y' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
|
|
|
|
function f3() {
|
|
const obj3 = {};
|
|
obj3.x = 1;
|
|
obj3.y = Object.values(obj3); // Circularity error
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS7022: 'y' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
|
|
}
|
|
|