1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used...

Discussão em 'Angular' iniciado por Juergen Gross, Julho 4, 2025.

  1. How I can solve this error:

    TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'App'. No index signature with a parameter of type 'string' was found on type 'App'

    without // @ts-ignore as the index will be a method of the component itself? So I have no idea which "as keyof typeof" I should use.

    this[methodCall *as keyof typeof ???* ](obj)


    For better understanding, please refer to the snippet:

    @Component({
    ...
    export class App {
    ...
    keyup(obj: IVariableBuilder): void {

    const methodCall = 'keyup_' + 'X' // obj.variableName: here the prop is needed for delegation matter

    // @ts-ignore
    this[methodCall](obj); // related sub-function to the object input will be invoked
    }

    keyup_X(obj: IVariableBuilder): void {
    ....
    }


    For complete code, please refer tot stackblitz: https://stackblitz.com/edit/stackbl...c/main.ts&template=node&title=Angular Starter

    Continue reading...

Compartilhe esta Página