خرید بک لینک

Vote count: 0

I'm trying to create a simple Node.js console app using TypeScript ECMAScript6 using Visual Studio 2015 community edition and not able to use a class defined inside a module in app.ts. Visual studio does however displays the module "DataModels" as namespace and also the class in intellisence, but it throws an error while initializing it in app.ts

Error: ReferenceError: DataModels is not defined

Tried VS project settings using AMD and CommonJs as module system but no luck.

Folder structure

/
 app.ts
 DataModels.ts
 Scripts
  Typings (dir)
   Node   (dir)
    node.d.ts

app.ts

/// <reference path="DataModels.ts" />
var user: IUser = new DataModels.User();
user.Name = 'user1';
console.log(user.Name);

DataModels.ts

interface IUser {
    Name: string;
    Email: string;
    UserName: string;
    Password: string;
    ProfilePicPath: URL;

}

module DataModels {

    export class User implements IUser {
        private _name: string;
        private _email: string;
        private _useame: string;
        private _password: string;
        private _profilePicPath: URL;

        public get Name() {
            retu this._name;
        }
        public set Name(value) {
            this._name = value;
        }

        public get Email() {
            retu this._email;
        }
        public set Email(value) {
            this._email = value;
        }

        public get UserName() {
            retu this._useame;
        }
        public set UserName(value) {
            this._useame = value;
        }

        public get Password() {
            retu this._password;
        }
        public set Password(value) {
            this._password = value;
        }

        public get ProfilePicPath() {
            retu this._profilePicPath;
        }
        public set ProfilePicPath(value) {
            this._profilePicPath = value;
        }
    }
}

asked 1 min ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: شنبه 8 اسفند 1394 ساعت: 14:32

صفحه بندی