1

Why am I getting the error: TSDummyProject is not defined at runtime?

dbentities.d.ts:

declare module TSDummyProject.Models {
    export class Part {
        ID: number;
        PartName: string; 
        ...
    }
}

manager.ts:

/// <reference path="dbentities.d.ts"/>
class PartManagerController {
    private curPart: TSDummyProject.Models.Part;
    ...

    someFunction(){
        // error: TSDummyProject is not defined 
        this.curPart = new TSDummyProject.Models.Part(); 
    }
}

1 Answer 1

1

If you 'declare' something in typescript it does not generate any javascript. This is typescripts means of saying that "this is defined elsewhere e.g JavaScript code. Assume its there."

in your case it isn't. Perhaps you mean to write the code in typescript, or, forgot to include the aforementioned JavaScript in the page

Sign up to request clarification or add additional context in comments.

1 Comment

And how to import javascript export in typescript? Simple including the js file not working

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.