-
Notifications
You must be signed in to change notification settings - Fork 843
Open
Labels
Description
Describe the bug
Due to weird behavior in TypeScript (Mainly microsoft/TypeScript#37053) the use of /// <reference types="node" /> will leak to any consumers of a type definition file.
This means that if one wants to use some of the Stripe types, for example to define an interface for an API response (Which gets imported in the client) this will leak NodeJS types to all the client side code as well.
To Reproduce
- Observe the
Cannot find name 'process'. Do you need to install type definitions for node? Trynpm i --save-dev @types/nodeand then add 'node' to the types field in your tsconfig.error as expected - Change the code to import a type from
stripe - Observe the error disappearing
Expected behavior
The error regarding process persists
Code snippets
Minimal tsconfig.json:
{
"include": "test.ts",
"compilerOptions": {
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"types": []
}
}test.ts before importing:
// TS error as expected
process.exit()test.ts after importing:
import type { Stripe } from 'stripe';
const foo: Stripe.Price.Recurring.Interval;
// No error
process.exit()OS
macos
Node version
any
Library version
stripe-node 17.4.0
API version
N/A
Additional context
No response