TypeScript Version: master, due to #27128
Search Terms:
is used before being assigned, property on function, expando
Code
// test.js
class TestClass {}
TestClass.NONE = 'NONE';
function fn() {
console.log(TestClass.NONE); // error TS2565: Property 'NONE' is used before being assigned.
}
test with tsc --strict --allowJs --checkJs --noEmit
Expected behavior:
No error.
Error only seems to appear if the property is accessed within another function body, not top-level (or same level). Not an error without --strictNullChecks.
Testing with latest found this error when a property was defined on a function or class (outside its body) and then required from a different file, but it appears to be the same problem if they're in the same file, as in the example above.
TypeScript Version: master, due to #27128
Search Terms:
is used before being assigned, property on function, expando
Code
test with
tsc --strict --allowJs --checkJs --noEmitExpected behavior:
No error.
Error only seems to appear if the property is accessed within another function body, not top-level (or same level). Not an error without
--strictNullChecks.Testing with latest found this error when a property was defined on a function or class (outside its body) and then required from a different file, but it appears to be the same problem if they're in the same file, as in the example above.