Git Product home page Git Product logo

Comments (7)

stephenh avatar stephenh commented on July 24, 2024

Thanks for the report; kind of surprised b/c ts-proto generally tries to understand packages, although the mapping between a proto package and JS/TS module and file paths are all kind of murky. I'll try to take a look at this soon. I might get distracted reorganizing some of the test projects to make this easier to repro...

from ts-proto.

stephenh avatar stephenh commented on July 24, 2024

Oh wait, I see. I missed that local message Foo when I first scanned this issue this morning.

Yeah, that will be a little bit more involved.

In theory, the ts-poet library that ts-proto uses is supposed to solve exactly this sort of "fancy auto-import" type thing, but it doesn't realize there could be local vs. imported symbol conflicts.

So, ideally getting ts-poet fixed would transitively fix this issue, although then there is a small wrinkle that ts-poet has a 3.x API out that is a fairly big breaking change from the 2.x API that ts-proto is currently using.

Basically, yeah, I see the issue, and will (likely slowly but hopefully steadily) work towards a fix.

from ts-proto.

stephenh avatar stephenh commented on July 24, 2024

As an update here, I implemented import collision avoidance in the latest/3.x API for ts-poet, see this test case:

https://github.com/stephenh/ts-poet/blob/master/src/index-tests.tsx#L163

Which is cool, but now means either: a) backporting that feature to the ts-poet 2.x branch that ts-proto uses (...probably easier?), or b) migrating ts-proto onto ts-poet 3.x (best for the long term and should not be hard but definitely tedious work).

If this is a big pain point/blocker for you, you could look into either of those, otherwise I'll get around to b) at some point.

from ts-proto.

jeffpyke avatar jeffpyke commented on July 24, 2024

Thanks, that's neat! It's not a huge pain point right now, because we can just delete the (unused) conflicting import manually. Looking forward to the fix! I think it will be useful once we generate a larger number of proto ts interfaces (right now 10-20), but eventually have 1000s of proto files in a mono repo we would like to generate ts interfaces for. Thanks, this project is great!

from ts-proto.

stephenh avatar stephenh commented on July 24, 2024

Hey @jeffpyke , so it took a few months, but I got around to the ts-poet upgrade, so this should be fixed now in v1.47.0. Let me know if you still see issues. Thanks!

from ts-proto.

stezu avatar stezu commented on July 24, 2024

@stephenh I'm having a similar issue with the latest version of ts-proto. I created a sample repo to help explain. I have a proto file which imports messages from two other proto files which happen to have the same name. ts-proto (and by extension ts-poet) don't avoid the naming conflict so I end up with the following in my output TS file:

import { User } from "../protos/auth/types";
import { User } from "../protos/user/types";

I'll spend some time digging into the issue for a good place to resolve it, but if you have any pointers, they would be greatly appreciated!

from ts-proto.

stephenh avatar stephenh commented on July 24, 2024

@stezu okay, try ts-proto v1.56.0, and see if that fixes it. Thanks!

from ts-proto.

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.