Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add types for browser #11779

Open
vixalien opened this issue May 7, 2022 · 4 comments
Open

Add types for browser #11779

vixalien opened this issue May 7, 2022 · 4 comments
Labels
new feature This change adds new functionality, like a new method or class

Comments

@vixalien
Copy link

vixalien commented May 7, 2022

Do you want to request a feature or report a bug?

I want to request a feature.

What is the current behavior?

I want to start using the Mongoose browser script from non-Node environments (Deno in this case) mainly for the robust Schema API (Validations) but I won't get types because there are no types for the browser script.

What is the expected behavior?

It would be nice if there were types for browser and amazing if there were types for schema only.

What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.

NodeJS: no
Deno: 1.21.0
MongoDB: 5.0.7
Mongoose: 6.3.2

@Uzlopak
Copy link
Collaborator

Uzlopak commented May 7, 2022

tbh, I didnt know that there are special typings for browser environments. Do you have some more information about that?

Btw. I tested few weeks ago mongoose in deno and it seems that esm support works properly now. So probably you dont need the browser version of mongoose but can use the node version of it. Or is it because of dependencies?

Would be cool if you could point out the issues with using deno, then we could adapt mongoose properly for deno.

@vixalien
Copy link
Author

vixalien commented May 7, 2022

What do you mean mongoose in Deno? How did you get that to work??? I think it's impossible unless you poly-patch all the Node dependencies (stream, buffer, crypto etc).

I don't think there are special typings for browser environments, but the typings for mongoose are all currently node-dependant and so would NOT work on a browser environment (read: non-node environment).

Mongoose can't work on Deno, atleast as of now, all I needed is the types for the schema. I was trying to create a PR but it's way too complex (for me atleast).

@Uzlopak
Copy link
Collaborator

Uzlopak commented May 8, 2022

Ok, I guess without patching those it is not possible.But mongoose seem to load in deno

#9056 (comment)

@vixalien
Copy link
Author

vixalien commented May 8, 2022

oh okay

@IslandRhythms IslandRhythms added the new feature This change adds new functionality, like a new method or class label May 9, 2022
@vkarpov15 vkarpov15 added this to the 6.x Unprioritized milestone May 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature This change adds new functionality, like a new method or class
Projects
None yet
Development

No branches or pull requests

4 participants