Coder Social home page Coder Social logo

Comments (9)

kyle-ssg avatar kyle-ssg commented on July 2, 2024 1

Added in bullet-train-client and react-native-bullet-train 0.2.3, enjoy!

If you find any type issues, comment here but think everything is covered.

from flagsmith-js-client.

crutchcorn avatar crutchcorn commented on July 2, 2024 1

Also, instead of having a webpack fix, what I might suggest is doing something like:

shared_types.ts:

export interface Test {
    example: string;
}

export interface Other {
   oneMore: number;
}

Then, in each of the instances you need those types:

declare module 'bullet-train-client' {
    export * from './shared_types;
}

That way, you can have a single source-of-truth without having to deal with webpack copy messiness. Feel free to ping me about TS-related issues for this project in the future :) I'd love to be of assistance!

from flagsmith-js-client.

crutchcorn avatar crutchcorn commented on July 2, 2024

I'm getting a build failure when using TS as-of version 0.2.3 in Angular.

7016: Could not find a declaration file for module 'bullet-train-client'. '/Users/crutchcorn/git/Coopervision/CVExtreme/node_modules/bullet-train-client/index.js' implicitly has an 'any' type.
  Try `npm install @types/bullet-train-client` if it exists or add a new declaration (.d.ts) file containing `declare module 'bullet-train-client';`

2 import bulletTrain from 'bullet-train-client';
                          ~~~~~~~~~~~~~~~~~~~~~

However, renaming the bullet-train-client.d.ts file to index.d.ts in node_modules fixes this for me

from flagsmith-js-client.

crutchcorn avatar crutchcorn commented on July 2, 2024

Another fix for this would be to add the following to package.json:

  "types": "./bullet-train-client.d.ts"

However, I think that the isomorphic import would also break. I would suggest moving both d.ts files into the same index.d.ts file (since they're namespaced, it should work properly) and then adding it to the types field in package.json

I can make a PR if that'd help

from flagsmith-js-client.

kyle-ssg avatar kyle-ssg commented on July 2, 2024

Ah strange, but I totally see what you mean about combining. I think ideally I'd look to also have some automated webpack approach for this since react-native, isomorphic AND the general lib have the same types.

Hmm, I didn't think naming as index.d.ts was a requirement, I'm sure other modules don't do this.

If you're offering to do that quickly though @crutchcorn that would definitely be appreciated!

from flagsmith-js-client.

crutchcorn avatar crutchcorn commented on July 2, 2024

Yup! It's somewhat blocking stuff at work, so let me see if I can't just fix this issue quickly :) Forking now!

from flagsmith-js-client.

kyle-ssg avatar kyle-ssg commented on July 2, 2024

Thanks, apologies about that! It's strange because running the client locally command clicking jumps to the .d.ts instead of the lib code which signifies it's working.

Regardless, I'll keep an eye out for this, do some quick sanity checks and publish a version as soon as I see it!

from flagsmith-js-client.

crutchcorn avatar crutchcorn commented on July 2, 2024

Right! Very weird, the differences between the TS language provider (for IDEs) and the compiler 🤷‍♂️

Either way #31 has been opened to help resolve this

from flagsmith-js-client.

kyle-ssg avatar kyle-ssg commented on July 2, 2024

Version @0.2.4 released, thank you again!

Will close for now, but reopen if you come across anything TS related.

from flagsmith-js-client.

Related Issues (20)

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.