Afaik "control flow analysis happens before typechecking", so this would only work, when the function has a declared type. That's in line with the linked existing improvement in TS 3.7, and to be expected.
🔍 Search Terms
Getter Get accessor must return a value never returning function error throw
✅ Viability Checklist
My suggestion meets these guidelines:
[x] This wouldn't be a breaking change in existing TypeScript/JavaScript code
[x] This wouldn't change the runtime behavior of existing JavaScript code
[x] This could be implemented without emitting different JS based on the types of the expressions
[x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
Suggestion
Produces the error
A 'get' accessor must return a value.(2378)
. Throwing an error directly would not. I feel similar to https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#better-support-for-never-returning-functions, a never-returning-function should have the same effect.Afaik "control flow analysis happens before typechecking", so this would only work, when the function has a declared type. That's in line with the linked existing improvement in TS 3.7, and to be expected.
🔍 Search Terms
Getter Get accessor must return a value never returning function error throw
✅ Viability Checklist
My suggestion meets these guidelines: