Skip to content

Getter (with setter) that doesn't return on all paths doesn't have a correct error span #32642

Closed
@stevenfowler16

Description

@stevenfowler16

TypeScript Version: 3.5.2

Search Terms:
ts2366
Code

export default class InputRadioButtonsWebComponent extends HTMLElement {
    private MapRadioButton: Map < HTMLInputElement, HTMLButtonElement > = new Map < HTMLInputElement, HTMLButtonElement > ();

    get Value() {
        for (const entry of this.MapRadioButton.entries()) {
            if (entry[0].checked === true) {
                return entry[0].value;
            }
        }

    }

    set Value(value: string) {
        if (value !== null) {
            this.setAttribute('value', value.toString());
        }
    }

}


let customElements = window.customElements;
if (customElements.get('radio-buttons') === undefined) {
    customElements.define('radio-buttons', InputRadioButtonsWebComponent);
}

Expected behavior:
Throw the error during the build process with the file and line specified.

Actual behavior:
Function lacks ending return statement and return type does not include undefined is thrown at the bottom of the file. The build provides zero idea as to where the error could have come from.
Looks like ESLint only runs on open files which was one reason why finding the file was so difficult.
Playground Link:
https://www.typescriptlang.org/play/#code/FAUwHgDg9gTgLgAgCYgGYEMCuAbRBjbdAZyIQEkA7CTOAJXSQEsoAhGuKCogdRACMAwlAC20CiAqJwcCUlIAJACoBZADIBRbCGETEAb2AIjCCDEYA3dDITL0Eek1btOALht2APErWVqcTdq6ADQI3qpscBwUATqSAHwIALwI4gDu7hBeKqq+NDHBodkRUfnxABQAlADchsa1RgDmIIgAaujYmCCVCAYAkL2osAhleJxEUpIwAJ4IUKgIcAAWjEQAdLb2DMzFnKu6ZiBElRU9wP29jPNl+1MA2gAMALqreIsgeADWIEhJiclwME6Jz65xgzUwMAoCBuD2elg6IBqxmRKIAvuczr1UWdsWciM0EG0EWV4Z03OMzBQGsDMZdhqSQAgAIR-FI4bA085LFarfFwACCkTMfBoXQA5AyxSEGasOABlAGMKnHGr9bFY3rAYC44BafCYcYiUpwUjJVJKpBQVIvA0cYTGog1OkjW1GrSxE2rJpwMpimBbKAAWhFkTGYpOf2SmAoKFQSu+nLwrvt7t0a1j8d9-scwecXCl5CoNAc2zzPH4QlEnF01W1wCAA
Related Issues:
91

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Error MessagesThe issue relates to error messagingFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions