Typescript cannot invoke expression whost type lacks a call signature

Smokey Dawson

I'm aware there are similar questions but I havent found anything that answers my question so far Im just trying to create a simple function in my angular application

app.component.ts

formClick() {

    const formContainer = <HTMLElement>document.querySelector('.form-container');
    const spinner = <HTMLElement>document.querySelector('.loading-spinner');
    const form = <HTMLElement>document.querySelector('.email-form');

    form.style.display = 'none';
    spinner.style.display = 'block';

    setTimeout(function(){
       spinner.style.display = 'none';
       formContainer.innerHTML('<h1>Thanks! We will get back to you shortly</h1>')
    }, 1000);
} 

but im getting an error on my formContainer.innerHTML that says

[ts] Cannot invoke an expression whose type lacks a call signature. Type 'String' has no compatible call signatures. (property) Element.innerHtml: string

I'm not sure what this means, any help would be appreciated,

Thanks

Hung Tran

I think the problem is this line formContainer.innerHTML('<h1>Thanks! We will get back to you shortly</h1>').

It should be formContainer.innerHTML = '<h1>Thanks! We will get back to you shortly</h1>'

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

typescript Cannot invoke an expression whose type lacks a call signature?

From Dev

Typescript Compiler Cannot invoke an expression whose type lacks a call signature

From Dev

Cannot invoke an expression whose type lacks a call signature TypeScript error

From Java

Error: Cannot invoke an expression whose type lacks a call signature

From Java

Cannot invoke an expression whose type lacks a call signature

From Dev

Cannot invoke an expression whose type lacks a call signature, map

From Dev

TypeScript Compile Error Cannot invoke an expression whose type lacks a call signature

From Dev

Promises with typescript-2.x gives error :Cannot invoke an expression whose type lacks a call signature

From Dev

Cannot invoke an expression whose type lacks a call signature. Type has no compatible call signatures

From Dev

Cannot invoke an expression whose type lacks a call signature, while it has a signature

From Dev

How to fix "TS2349: Cannot invoke an expression whose type lacks a call signature"

From Dev

error TS2349: Cannot invoke an expression whose type lacks a call signature

From Dev

TypeScript: Cannot use 'new' with an expression whose type lacks a call or construct signature

From Dev

TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. Mongoose

From Dev

How do I fix "Cannot use 'new' with an expression whose type lacks a call or construct signature" in angular 4?

From Dev

Exporting typescript function "lacks a call signature"

From Dev

Exporting typescript function "lacks a call signature"

From Java

object[] | object[] type lacks a call signature for 'find(),foreach()'

From Dev

Error "Type IFoo<T> requires a construct signature but type Foo<T> lacks one" when implementing a newable generic interface in TypeScript

From Dev

TypeScript: Intersection Types for construct signature and a type doesn't work, but for call signature and a type does

From Dev

Type signature for a TypeScript HOF

From Dev

Cannot invoke value of type

From Dev

Typescript: Index signature is missing in type

From Dev

Cannot invoke add on the array type

From Dev

Cannot invoke initializer for type 'UnsafeMutablePointer'

From Dev

Cannot invoke $function with object of type *

From Dev

TypeScript 1.6 error: JSX element type XXX does not have any construct or call signature

From Dev

Cannot invoke initializer for type: with an argument list of type:

From Dev

How to invoke static method of type parameter in TypeScript

Related Related

  1. 1

    typescript Cannot invoke an expression whose type lacks a call signature?

  2. 2

    Typescript Compiler Cannot invoke an expression whose type lacks a call signature

  3. 3

    Cannot invoke an expression whose type lacks a call signature TypeScript error

  4. 4

    Error: Cannot invoke an expression whose type lacks a call signature

  5. 5

    Cannot invoke an expression whose type lacks a call signature

  6. 6

    Cannot invoke an expression whose type lacks a call signature, map

  7. 7

    TypeScript Compile Error Cannot invoke an expression whose type lacks a call signature

  8. 8

    Promises with typescript-2.x gives error :Cannot invoke an expression whose type lacks a call signature

  9. 9

    Cannot invoke an expression whose type lacks a call signature. Type has no compatible call signatures

  10. 10

    Cannot invoke an expression whose type lacks a call signature, while it has a signature

  11. 11

    How to fix "TS2349: Cannot invoke an expression whose type lacks a call signature"

  12. 12

    error TS2349: Cannot invoke an expression whose type lacks a call signature

  13. 13

    TypeScript: Cannot use 'new' with an expression whose type lacks a call or construct signature

  14. 14

    TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. Mongoose

  15. 15

    How do I fix "Cannot use 'new' with an expression whose type lacks a call or construct signature" in angular 4?

  16. 16

    Exporting typescript function "lacks a call signature"

  17. 17

    Exporting typescript function "lacks a call signature"

  18. 18

    object[] | object[] type lacks a call signature for 'find(),foreach()'

  19. 19

    Error "Type IFoo<T> requires a construct signature but type Foo<T> lacks one" when implementing a newable generic interface in TypeScript

  20. 20

    TypeScript: Intersection Types for construct signature and a type doesn't work, but for call signature and a type does

  21. 21

    Type signature for a TypeScript HOF

  22. 22

    Cannot invoke value of type

  23. 23

    Typescript: Index signature is missing in type

  24. 24

    Cannot invoke add on the array type

  25. 25

    Cannot invoke initializer for type 'UnsafeMutablePointer'

  26. 26

    Cannot invoke $function with object of type *

  27. 27

    TypeScript 1.6 error: JSX element type XXX does not have any construct or call signature

  28. 28

    Cannot invoke initializer for type: with an argument list of type:

  29. 29

    How to invoke static method of type parameter in TypeScript

HotTag

Archive