Skip to content

Commit

Permalink
fix: prevent ReferenceError, update compatibility to ES2020 and Node …
Browse files Browse the repository at this point in the history
…18+ (#356)
  • Loading branch information
stainless-bot authored Oct 6, 2023
1 parent 3799863 commit fc71a4b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ TypeScript >= 4.5 is supported.

The following runtimes are supported:

- Node.js 16 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.
- Node.js 18 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.
- Deno v1.28.0 or higher, using `import OpenAI from "npm:openai"`.
- Bun 1.0 or later.
- Cloudflare Workers.
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
"prepublishOnly": "echo 'to publish, run yarn build && (cd dist; yarn publish)' && exit 1",
"format": "prettier --write --cache --cache-strategy metadata . !dist",
"tsn": "ts-node -r tsconfig-paths/register",
"lint": "eslint --ext ts,js .",
"fix": "eslint --fix --ext ts,js ."
},
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions src/_shims/node-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ async function getMultipartRequestOptions<T extends {} = Record<string, unknown>
export function getRuntime(): Shims {
// Polyfill global object if needed.
if (typeof AbortController === 'undefined') {
// @ts-ignore
AbortController = AbortControllerPolyfill;
// @ts-expect-error (the types are subtly different, but compatible in practice)
globalThis.AbortController = AbortControllerPolyfill;
}
return {
kind: 'node',
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"include": ["src", "tests", "examples"],
"exclude": ["src/_shims/**/*-deno.ts"],
"compilerOptions": {
"target": "es2019",
"target": "es2020",
"lib": ["es2020"],
"module": "commonjs",
"moduleResolution": "node",
Expand Down

0 comments on commit fc71a4b

Please sign in to comment.