Skip to content
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

Ts worker fix #1140

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions worker/index.node.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="node" />
Empty file added worker/index.workerd.d.ts
Empty file.
12 changes: 10 additions & 2 deletions worker/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{
"name": "helicone-worker",
"version": "0.0.0",
"pnpm": {
"patchedDependencies": {
"@types/node@20.8.9": "patches/@types__node@20.8.9.patch"
},
"overrides": {
"@types/node": "20.8.9"
}
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20221111.1",
"@types/async-retry": "^1.4.5",
Expand All @@ -12,14 +20,14 @@
"dotenv": "^16.0.3",
"jest": "^29.5.0",
"ts-jest": "^29.1.0",
"typescript": "^4.9.3",
"typescript": "^5.3.3",
"wrangler": "^3.6.0"
},
"private": true,
"scripts": {
"start": "wrangler dev",
"deploy": "wrangler publish",
"lint": "eslint --ext .js,.jsx,.ts,.tsx ./src --max-warnings=0",
"lint": "tsc && eslint --ext .js,.jsx,.ts,.tsx ./src --max-warnings=0",
"lint-fix": "eslint --ext .js,.jsx,.ts,.tsx ./src --fix",
"test": "jest"
},
Expand Down
20 changes: 20 additions & 0 deletions worker/patches/@types__node@20.8.9.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/index.workerd.d.ts b/index.workerd.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/package.json b/package.json
index e9e15c90021711122a01a324f07f3675e13e1e14..b04e27142c8ef196d8bb3bb53661794fde3569e7 100644
--- a/package.json
+++ b/package.json
@@ -213,6 +213,12 @@
],
"main": "",
"types": "index.d.ts",
+ "exports": {
+ "workerd": {
+ "types": "./index.workerd.d.ts"
+ },
+ "types": "./index.d.ts"
+ },
"typesVersions": {
"<=4.8": {
"*": [
10 changes: 6 additions & 4 deletions worker/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */

/* Language and Environment */
"target": "es2021" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
"customConditions": ["workerd", "worker", "browser"],
"target": "ESNext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
"lib": [
"es2021"
"ESNext"
] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
"jsx": "react" /* Specify what JSX code is generated. */,
"moduleResolution": "NodeNext",
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
Expand All @@ -26,9 +28,9 @@
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */

/* Modules */
"module": "es2022" /* Specify what module code is generated. */,
"module": "NodeNext" /* Specify what module code is generated. */,
// "rootDir": "./", /* Specify the root folder within your source files. */
"moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */,

// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
Expand Down
Loading