diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d8a19c1..e815b72 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,3 @@ -# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - name: Build & test on: @@ -14,14 +11,14 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: - node-version: lts/* + node-version: 20 cache: yarn - run: yarn install --pure-lockfile - run: yarn typecheck - run: yarn test - - run: yarn build \ No newline at end of file + - run: yarn build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 15d91a4..3c6efae 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,3 @@ -# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - name: Release on: @@ -9,15 +6,15 @@ on: - "v*" jobs: - build: + release: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: - node-version: lts/* + node-version: 20 cache: yarn - run: yarn install --pure-lockfile diff --git a/LICENSE b/LICENSE index f383598..d443dbe 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022 Swan +Copyright (c) 2024 Swan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 5d6cf1d..fa6c709 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Request.make({ url: "/api/health" }).onResolve(console.log); // Result.Ok({status: 200, ok: true, response: Option.Some("{\"ok\":true}")}) // Timeout -Request.make({ url: "/api/health", timeout: 50 }).onResolve(console.log); +Request.make({ url: "/api/health", timeout: 2000 }).onResolve(console.log); // Result.Error(TimeoutError) // Network error diff --git a/src/Request.ts b/src/Request.ts index 4c7f4bb..158adc4 100644 --- a/src/Request.ts +++ b/src/Request.ts @@ -10,6 +10,7 @@ type JsonValue = JsonPrimitive | JsonObject | JsonArray; // The type system allows us infer the response type from the requested `responseType` type ResponseType = "text" | "arraybuffer" | "document" | "blob" | "json"; + type ResponseTypeMap = { text: string; arraybuffer: ArrayBuffer; diff --git a/tsconfig.json b/tsconfig.json index ef94261..076bbd7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,22 +1,30 @@ { "include": ["src"], "compilerOptions": { - "module": "ES2015", - "target": "ES2015", - "lib": ["DOM", "DOM.Iterable", "ES2017"], + "module": "ESNext", + "target": "ES2018", + "lib": ["DOM", "DOM.Iterable", "ES2018"], "moduleResolution": "Node", "outDir": "dist/", "allowJs": false, "declaration": true, - "esModuleInterop": true, "noEmit": true, "sourceMap": true, "strict": true, + "skipLibCheck": true, "stripInternal": true, + // https://www.typescriptlang.org/tsconfig#Type_Checking_6248 + "allowUnreachableCode": false, + "allowUnusedLabels": false, + "exactOptionalPropertyTypes": true, "noFallthroughCasesInSwitch": true, + "noImplicitOverride": true, + "noImplicitReturns": false, + "noPropertyAccessFromIndexSignature": true, "noUncheckedIndexedAccess": true, - "forceConsistentCasingInFileNames": true + "noUnusedLocals": true, + "noUnusedParameters": true } }