yozawiratama
yozawiratama

Reputation: 4318

typescript error has no member

i use this :

/// <reference path="typings/jquery/jquery.d.ts" />
/// <reference path="typings/angularjs/angular.d.ts" /> 
/// <reference path="typings/angularjs/angular-animate.d.ts" /> 
/// <reference path="typings/angular-ui-router/angular-ui-router.d.ts" /> 
/// <reference path="typings/angular-ui-bootstrap/angular-ui-bootstrap.d.ts" /> 
/// <reference path="typings/angular-file-upload/angular-file-upload.d.ts" />

/// <reference path="typings/selectize/selectize.d.ts" />

i get error like this :

Access/Interfaces.ts(5,52): error TS2305: Module 'ng' has no exported member 'IPromise'.
Access/Interfaces.ts(6,123): error TS2305: Module 'ng' has no exported member 'IPromise'.
bower_components/angular-ui-router/api/angular-ui-router.d.ts(31,38): error TS2304: Cannot find name 'IServiceProvider'.
bower_components/angular-ui-router/api/angular-ui-router.d.ts(49,42): error TS2304: Cannot find name 'IServiceProvider'.
bower_components/angular-ui-router/api/angular-ui-router.d.ts(82,63): error TS2304: Cannot find name 'IPromise'.
typings/angularjs/angular-animate.d.ts(18,30): error TS2305: Module 'ng' has no exported member 'IAugmentedJQuery'.
typings/angularjs/angular-animate.d.ts(19,30): error TS2305: Module 'ng' has no exported member 'IAugmentedJQuery'.
typings/angularjs/angular-animate.d.ts(20,33): error TS2305: Module 'ng' has no exported member 'IAugmentedJQuery'.
typings/angularjs/angular-animate.d.ts(21,36): error TS2305: Module 'ng' has no exported member 'IAugmentedJQuery'.
typings/angularjs/angular-animate.d.ts(22,33): error TS2305: Module 'ng' has no exported member 'IAugmentedJQuery'.
typings/angularjs/angular.d.ts(17,1): error TS2440: Import declaration conflicts with local declaration of 'ng'

how to solve this? and in my visual studio code i get error has no exported member 'IPromise' this is my code :

///<reference path="../all.ts" />
module Interface{
    'use strict'
     export interface IAccessService {
        Login(PhoneNumber: string, 
            Password: string): ng.IPromise<any>;
        Register(Email: string, 
            PhoneNumber : string,
            Password: string, 
            RePassword: string, 
            Fullname: string, 
            BirthDate: Date, 
            Sex: string[]): ng.IPromise<any>;
        GetTokenFromCookies(): string;
        Put(token: string);
    }
}

Upvotes: 2

Views: 11909

Answers (2)

L.Rossi
L.Rossi

Reputation: 11

I believe that is due to the TypeScript package version that you are using. Check the version with

npm list typescript

If you have installed version 1.4 or higher, try to remove and install an older version, since some changes happened that may be causing those conflicts.

Upvotes: 1

afaayerhan
afaayerhan

Reputation: 243

As I can see you have multiple type definations for angular-ui-route in your bower_components folder and also in you typings folder go to your bower_components folder and remove the angular-ui-router.d.ts file there. the errors are popoping up because of multiple typedefinations. if you have multiple type definitions in your project and you are compiling everything with it. it would give you this error and other unrelated errors would popup too. I hope this solves your problem

Upvotes: 2

Related Questions