typescript error has no member

11,881

Solution 1

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

Solution 2

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.

Share:
11,881
yozawiratama
Author by

yozawiratama

Updated on June 04, 2022

Comments

  • yozawiratama
    yozawiratama almost 2 years

    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);
        }
    }