1

Upon closer examination the file generated together with the .js file built by JaySvcUtil -- in my case called BO_Data.d.ts cannot resolve the two references to $data.IPromise. This started happening after I added a new table in the database, regenerated my .edmx model in Visual Studio and then regenerated the entity model with JaySvcUtil.exe.

declare module WcfService1 {
export class BOLOEntities extends $data.EntityContext {
onReady(): $data.IPromise;
onReady(handler: (context: BOLOEntities) => void): $data.IPromise;

In the console I see this error: typeOrName requires a value other than undefined or null at this line in my code:

window['bolo'] = new WcfService1.BOLOEntities(oProviderConfig);

Thanks in advance!

P.S. I did this, but it didn't help: TypeScript compile errors with JayData library and JaySvcUtil generated code

1 Answers1

0

So it seems I was doing only one of the two things described in TypeScript compile errors with JayData library and JaySvcUtil generated code

You must:

1) Change jaydata.d.ts

declare module $data {
    interface IPromise<T> extends Object {
        then: {
            (handler: (args: T) => void ): IPromise<any>;
            (handler: (args: T) => any): IPromise<any>;
        };
        fail: {
            (handler: (args: T) => void ): IPromise<any>;
            (handler: (args: T) => any): IPromise<any>;
        };
       valueOf(): any;
    }

to etc etc etc valueOf(): Object;

and 2) In your generated typescript file *.d.ts. Change this:

  onReady(): $data.IPromise;
  onReady(handler: (context: BOLOEntities) => void): $data.IPromise;

to this:

  onReady(): $data.IPromise<any>;
  onReady(handler: (context: BOLOEntities) => void): $data.IPromise<any>;

where context: is your own context.