TypeScript Build Error : Property does not exist on type 'IStateParamsService'

Foyzul Karim

I am using TypeScript almost entire of my client project. Currently I am facing a technical problem.

In my HTML, I have an anchor tag like below :

    <a class="btn btn-default mrm" ui-sref="course-detail({courseId: '{{c.Id}}'})">Details</a>

In my course detail controller, I am getting the values in the stateparam variable. But if I want to access my 'courseId' from that variable, it is giving me build error. Please check the image below.

TypeScript Code with Build Error

But if I remove the IF block, then I am getting the log in the developer console like below.

Console Log by commenting the build error code

I must get the course Id property and value to proceed. Otherwise I need to code this controller in pure angularjs which I don't want. Thanks.

Ethnar

Typescript prefers to work on maps explicitly through brackets notation [].

If you want to get a field out of a map-like object you should use square brackets instead of dot notation:

if (this.param['courseId'] === "00000....0000") {
  //.. rest of the code

That should solve the immediate issue you're facing.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

New Typescript 1.8.4 build error: " Build: Property 'result' does not exist on type 'EventTarget'. "

From Dev

Typescript compile error: Property 'classList' does not exist on type 'Node'

From Dev

How to avoid typescript error: Property 'innerHTML' does not exist on type 'Element'

From Dev

Typescript error: Property 'value' does not exist on type 'Observable<any>'

From Java

useRef Typescript error: Property 'current' does not exist on type 'HTMLElement'

From Dev

Typescript Error TS2339: Property 'project' does not exist on type '{}'

From Dev

Typescript compile error: Property 'bodyParser' does not exist on type 'typeof e'

From Dev

TypeScript throws error "Property 'breadcrumb' does not exist on type 'Data'."

From Dev

Ionic TypeScript Error (Property 'nav' does not exist on type 'HomePage')

From Dev

Ionic 3 TypeScript Error - Property 'then' does not exist on type 'void'

From Dev

Typescript error Property does not exist on type 'HTMLElement'. any

From Java

Property 'value' does not exist on type EventTarget in TypeScript

From Java

jest typescript property mock does not exist on type

From Dev

Typescript property does not exist on type 'ElementFinder'

From Dev

Typescript: Property 'src' does not exist on type 'HTMLElement'

From Dev

TypeScript - Property 'id' does not exist on type 'Node'

From Dev

TypeScript: Property 'propertyName' does not exist on type 'Function'

From Dev

Property 'load' does not exist on type TypeScript?

From Dev

Typescript property does not exist on type 'ElementFinder'

From Dev

Typescript - Property 'scrollY' does not exist on type 'HTMLElement'

From Dev

class declaration - Property does not exist on type in TypeScript

From Dev

ng build error - Property does not exist

From Dev

Error: Property 'then' does not exist on type 'void'

From Dev

Using TypeScript, and Object.assign gives me an error "property 'assign' does not exist on type 'ObjectConstructor'"

From Dev

Typescript generates a 'property does not exist on type' error (code converted from JS)

From Dev

TypeScript | Array.from | error TS2339: Property 'from' does not exist on type 'ArrayConstructor'

From Dev

Typescript throws a property does not exist on type even with type file included

From Dev

Property 'subscribe' does not exist on type 'Observable<User> | Error'. Property 'subscribe' does not exist on type 'Error'

From Java

Ignore Typescript Errors "property does not exist on value of type"

Related Related

  1. 1

    New Typescript 1.8.4 build error: " Build: Property 'result' does not exist on type 'EventTarget'. "

  2. 2

    Typescript compile error: Property 'classList' does not exist on type 'Node'

  3. 3

    How to avoid typescript error: Property 'innerHTML' does not exist on type 'Element'

  4. 4

    Typescript error: Property 'value' does not exist on type 'Observable<any>'

  5. 5

    useRef Typescript error: Property 'current' does not exist on type 'HTMLElement'

  6. 6

    Typescript Error TS2339: Property 'project' does not exist on type '{}'

  7. 7

    Typescript compile error: Property 'bodyParser' does not exist on type 'typeof e'

  8. 8

    TypeScript throws error "Property 'breadcrumb' does not exist on type 'Data'."

  9. 9

    Ionic TypeScript Error (Property 'nav' does not exist on type 'HomePage')

  10. 10

    Ionic 3 TypeScript Error - Property 'then' does not exist on type 'void'

  11. 11

    Typescript error Property does not exist on type 'HTMLElement'. any

  12. 12

    Property 'value' does not exist on type EventTarget in TypeScript

  13. 13

    jest typescript property mock does not exist on type

  14. 14

    Typescript property does not exist on type 'ElementFinder'

  15. 15

    Typescript: Property 'src' does not exist on type 'HTMLElement'

  16. 16

    TypeScript - Property 'id' does not exist on type 'Node'

  17. 17

    TypeScript: Property 'propertyName' does not exist on type 'Function'

  18. 18

    Property 'load' does not exist on type TypeScript?

  19. 19

    Typescript property does not exist on type 'ElementFinder'

  20. 20

    Typescript - Property 'scrollY' does not exist on type 'HTMLElement'

  21. 21

    class declaration - Property does not exist on type in TypeScript

  22. 22

    ng build error - Property does not exist

  23. 23

    Error: Property 'then' does not exist on type 'void'

  24. 24

    Using TypeScript, and Object.assign gives me an error "property 'assign' does not exist on type 'ObjectConstructor'"

  25. 25

    Typescript generates a 'property does not exist on type' error (code converted from JS)

  26. 26

    TypeScript | Array.from | error TS2339: Property 'from' does not exist on type 'ArrayConstructor'

  27. 27

    Typescript throws a property does not exist on type even with type file included

  28. 28

    Property 'subscribe' does not exist on type 'Observable<User> | Error'. Property 'subscribe' does not exist on type 'Error'

  29. 29

    Ignore Typescript Errors "property does not exist on value of type"

HotTag

Archive