Add types for browser
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
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.
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).
Ok, I guess without patching those it is not possible.But mongoose seem to load in deno
https://github.com/Automattic/mongoose/issues/9056#issuecomment-1104533278
oh okay
This will be fixed with #15385 in Mongoose 9: you'll get the full Mongoose global in the browser, so same types.