arcjet / arcjet-js

Arcjet JS SDKs. Rate limiting, bot protection, email verification & attack defense for Node.js, Next.js, Bun & SvelteKit.
https://arcjet.com
Apache License 2.0
182 stars 3 forks source link

Should we include typescript in peerDependencies? #1029

Open davidmytton opened 3 weeks ago

davidmytton commented 3 weeks ago

I had a user report a compile error which turned out to be because they were using TypeScript 4.9.5. Updating to the latest version (5.5.2) solved this. Should we add TypeScript >= to peerDependencies?

21:28:15.573 • Next.js 14.2.3
--
21:28:15.574 |  
21:28:15.575 | Linting and checking validity of types
21:28:24.363 | Failed to compile.
21:28:24.363
21:28:24.364 /node_modules/-pnpm/@arcjet+next@1.0.0-alpha.13_@bufbuild+protobuf@1.10.0_@connectrpc+connect@1.4.0_next@14.2.3/node_modules/@arcjet/next/index.d.ts:84:36
21:28:24.364 Type error: Type parameter declaration expected.
21:28:24.364 |  
21:28:24.364 | 82 | * @param options - Arcjet configuration options to apply to all requests.
21:28:24.364 | 83 | * /
21:28:24.364 | > 84 export default function arcjetNext<const Rules extends (Primitive | Product)[]>(options: ArcjetOptions<Rules>): ArcjetNext<Simpify<ExtraProps<Rules>>>;
21:28:24.364 |  
21:28:24.364 | 85 /**
21:28:24.364 | 86 | * Protects your Next.js application using Arcjet middleware. 
21:28:24.364 | 87
21:28:24.399 | ELIFECYCLE Command failed with exit code 1.
21:28:24.420 | Error: Command "pnpm run build" exited with 1
21:28:24.977
blaine-arcjet commented 3 weeks ago

I don't believe I've ever seen a project specify typescript as a peerDependency so I don't think we should.

Additionally, peerDependencies wouldn't solve the issue here because the newer TypeScript would be installed in node_modules/@arcjet/next/node_modules/typescript and they would still be compiling with typescript 4.9.5 which they installed at the top level.