user1151646
user1151646

Reputation:

Angular2 and TypeScript error "Property METHOD_NAME does not exist on type 'typeof CLASS_NAME'

I need some help. I'm playing with basics of Angular2 and TypeScript as a part of my switch from A1 to A2 so something here might be obvious for you.

I have a this situation:

  1. Webpack in use.
  2. AppConfigConst holds some static, app wide configuration data.
  3. AppConfigurationInjectable takes AppConfigConst and exposes simple API to access configuration data.
  4. SelectedLanguageInjectable want's to use method from AppConfigConst and here I get this:

ERROR in [default] C:_DEV\XXX\src\app\shared\selected-language\selected-language.injectable.ts:9:46 Property 'getSupportedUiLanguages' does not exist on type 'typeof AppConfigurationInjectable'.

enter image description here

Upvotes: 3

Views: 2364

Answers (1)

eko
eko

Reputation: 40647

You have a mistake in your constructor. It should be:

constructor(private appConfiguration: AppConfigurationInjectable){

change = with :

: is for defining types in typescript = is for setting a value as you know.

Upvotes: 5

Related Questions