Code Monkey home page Code Monkey logo

Comments (7)

bodia-uz avatar bodia-uz commented on May 28, 2024

Hey @jgornick !
Glad you're using ODataFilterBuilder!

I will fix it soon.

Have You tried esModuleInterop from typescript 2.7?
It should fix Your issue for now.
With this option your import should be:

import ODataFilterBuilder from 'odata-filter-builder';

from odata-filter-builder.

jgornick avatar jgornick commented on May 28, 2024

Nice! Haven't been able to upgrade yet to 2.7.x, but will give this a try when I can upgrade. If I have some time, I'll first look into providing a PR with the fix.

Thanks!

from odata-filter-builder.

bodia-uz avatar bodia-uz commented on May 28, 2024

Published version 1.0.0-0 with updated export:

export {
canonicalFunctions,
ODataFilterBuilder
};
export default ODataFilterBuilder;

Could be installed via

> npm install odata-filter-builder@next

from odata-filter-builder.

bodia-uz avatar bodia-uz commented on May 28, 2024

With ts we have one more issue:

TypeError: Class constructor ODataFilterBuilder cannot be invoked without 'new'

Mb will drop support of ODataFilterBuilder without new.

@jgornick what do You think?

from odata-filter-builder.

jgornick avatar jgornick commented on May 28, 2024

Externally, sure it makes sense to not support a consumer creating a new instance of ODataFilterBuilder.

Another option would be to allow the creation of new instances and then having "static" methods to create a new instance of ODataFilterBuilder:

const fb: ODataFilterBuilder = ODataFilterBuilder.and();

// or

const fb: ODataFilterBuilder = ODataFilterBuilder.or();

Thoughts?

from odata-filter-builder.

bodia-uz avatar bodia-uz commented on May 28, 2024

Static methods for creating (and and or) are already available
https://github.com/bodia-uz/odata-filter-builder/blob/v1.0.0-0/src/ODataFilterBuilder.js#L230-L231

But the documentation for them could be better.

Currently, doc says to use:

const fb: ODataFilterBuilder = ODataFilterBuilder();

fb.eq('x', 1);

Need to depracate old format and update doc with:

const fb: ODataFilterBuilder = new ODataFilterBuilder();
// or
const fb: ODataFilterBuilder = ODataFilterBuilder.and();
// or
const fb: ODataFilterBuilder = ODataFilterBuilder.or();

fb.eq('x', 1);

Or/And mb add factory functions to module export:

import { and, or } from "odata-filter-builder";
// import { createAnd, createOr } from "odata-filter-builder";

const fb: ODataFilterBuilder = and();
// or
const fb: ODataFilterBuilder = or();

from odata-filter-builder.

jgornick avatar jgornick commented on May 28, 2024

@bodia-uz This is looking awesome! I like the ability to just use and() or or() as factory methods. Awesome stuff!

from odata-filter-builder.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.