Search code examples
javascriptbreeze

breeze.Predicate instruction valid with JavaScript but not with TypeScript


I successfully performs breeze predicates like this with Javascript:

var p3 =  new breeze.Predicate('items', 'any', 'serialNumber', breeze.FilterQueryOp.Contains, '12345');

So I search for any items where any of these items have a serial number which contains 12345.

I need to performs same kind of query on a Typescript page but I get an error in VS:

enter image description here

Where I click 'Go To Definition' for Predicate:

class Predicate {
    constructor (property: string, operator: string, value: any, valueIsLiteral?: boolean);
    constructor (property: string, operator: FilterQueryOpSymbol, value: any, valueIsLiteral?: boolean);

So it seems that the breeze type definitions (used by typescript pages) dons not include a definition for this function with these number of parameters.

This is breeze.d.ts version is 1.4

Question: how to get it to work with a typescript page?

PS: it works pretty well on another Javascript page so I think it should be possible to get it working on a Typescript page, isn't it?

Thanks.


Solution

  • Sorry, I missed that, but it's fixed now. Please get the latest version of breeze.d.ts from the Breeze github repo. I've sent a pull request to DefinitelyTyped also, but that can take a few days.

    Thanks for letting us know.