-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
In package.json, move @types/* from dependencies to devDependencies #5073
Comments
Hi! Please see the rationale there: microsoft/types-publisher#81 (comment) |
My understanding of that comment is that, for As a practical example: The package sharp has a devDependency on @types/node (source code). However, |
@darrachequesne Can you please revisit this issue? |
Hmm, that's not my understanding:
This was discussed here for the v3 release: #3690 |
I see that this topic has been discussed multiple times. Sorry if I still bring it up. After reading both links, I still don't understand why moving Maybe I am missing something... By the way, when v3 was released, I assume that many other users did succeed in using it (both in dev and in production). So I wonder if the author of that issue had another weird problem that was worked-around by moving the dependencies... Edit: Also, I have never seen any other npm package that needed to do this. So, I wonder what is unique here. |
That's because those types are exposed in the public API of the /// <reference types="node" />
import { EventEmitter } from "events";
import { IncomingMessage, Server as HttpServer } from "http";
import { CookieSerializeOptions } from "cookie";
import { CorsOptions } from "cors";
// ...
export interface ServerOptions {
cookie?: (CookieSerializeOptions & {
name: string;
}) | boolean;
cors?: CorsOptions;
} So they need to be installed alongside the
|
|
I just had an idea: I searched on GitHub, and I found another TypeScript package that depends on cookie: https://www.npmjs.com/package/@auth0/nextjs-auth0?activeTab=dependencies In this project, @types/cookie is declared in devDependencies. And it has many
Finally, here are some end-user TypeScript projects that use this package and do not explicitly mention
Edit: More npm packages where |
@darrachequesne I finally figured out what I was missing: So if we still want to resolve this issue, the only idea I have is to clone What do you think? |
In order to prevent issues like: > error TS2345: Argument of type 'RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>' is not assignable to parameter of type 'Middleware'. > Types of parameters 'req' and 'req' are incompatible. > Type 'IncomingMessage' is missing the following properties from type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>': get, header, accepts, acceptsCharsets, and 29 more. > > io.engine.use(sessionMiddleware); ~~~~~~~~~~~~~~~~~ Related: socketio/socket.io#4644 We could also have use the RequestHandler type from the @types/express-serve-static-core package, but that would add 5 new dependencies. See also: https://github.com/socketio/engine.io/issues/673
Describe the bug
Currently, engine.io has @types/cookie, @types/cors and @types/node as dependencies. They should instead be devDependencies.
https://github.com/socketio/engine.io/blob/7033c0ed278705b569afef0bfe470c1937d1ec38/package.json#L33-L36
This is causing my projects to take many more packages as dependencies at runtime.
The text was updated successfully, but these errors were encountered: