@fastly/expressly 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.yarnrc.yml DELETED
@@ -1 +0,0 @@
1
- yarnPath: .yarn/releases/yarn-classic.cjs
@@ -1,34 +0,0 @@
1
- import { expectType } from 'tsd';
2
- import { Router } from "../dist";
3
- import { EReq } from "../dist/lib/routing/request";
4
- import { ERes } from '../dist/lib/routing/response';
5
- import { EErr } from "../dist/lib/routing/errors";
6
-
7
- // Default Err types
8
- {
9
- const router = new Router();
10
- router.use(async (err, _, res) => {
11
- expectType<EErr>(err)
12
- });
13
- }
14
-
15
- // Custom Req and Res types
16
- {
17
- interface MeowErr extends EErr {
18
- meow(): string
19
- }
20
-
21
- interface WoofErr extends EErr {
22
- woof(): string
23
- }
24
-
25
- interface MyErr extends MeowErr, WoofErr { }
26
-
27
- const router = new Router<EReq,ERes,MyErr>();
28
- router.use(async (err, _, res) => {
29
- expectType<MyErr>(err)
30
- err.meow()
31
- err.woof()
32
- });
33
-
34
- }
@@ -1,11 +0,0 @@
1
- import { expectError, expectType } from 'tsd';
2
- import { ERequest } from "../dist";
3
- import { EConfig } from "../dist/lib/routing";
4
- import { EReq } from "../dist/lib/routing/request";
5
-
6
- // ERequest
7
- expectError(ERequest())
8
- expectError(new ERequest())
9
- expectError(new ERequest({} as EConfig))
10
- expectType<EReq>(new ERequest({} as EConfig, {} as FetchEvent))
11
- expectType<(promise: Promise<any>) => void>(new ERequest({} as EConfig, {} as FetchEvent).waitUntil)
@@ -1,54 +0,0 @@
1
- import { expectType } from 'tsd';
2
- import { Router } from "../dist";
3
- import { EReq } from "../dist/lib/routing/request";
4
- import { ERes } from '../dist/lib/routing/response';
5
-
6
- // Default Req and Res types
7
- {
8
- const router = new Router();
9
- router.all('/', async (req, res) => {
10
- expectType<EReq>(req)
11
- expectType<ERes>(res)
12
- return res.send("Hello world!");
13
- });
14
- router.get('/', async (req, res) => {
15
- expectType<EReq>(req)
16
- expectType<ERes>(res)
17
- return res.send("Hello world!");
18
- });
19
- }
20
-
21
- // Custom Req and Res types
22
- {
23
- interface MeowReq extends EReq {
24
- meow(): string
25
- }
26
-
27
- interface WoofReq extends EReq {
28
- woof(): string
29
- }
30
-
31
- interface MyReq extends MeowReq, WoofReq { }
32
-
33
- interface WoofRes extends ERes {
34
- woof(): string
35
- }
36
-
37
- const router = new Router<MyReq, WoofRes>();
38
- router.all('/', async (req, res) => {
39
- expectType<MyReq>(req)
40
- expectType<WoofRes>(res)
41
- req.meow()
42
- req.woof()
43
- res.woof()
44
- return res.send("Hello world!");
45
- });
46
- router.get('/', async (req, res) => {
47
- expectType<MyReq>(req)
48
- expectType<WoofRes>(res)
49
- res.on('finish', finalResponse => {
50
- expectType<Response | undefined>(finalResponse)
51
- })
52
- return res.send("Hello world!")
53
- });
54
- }
package/tsconfig.json DELETED
@@ -1,25 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "outDir": "./dist/",
4
- "rootDir": "./src",
5
- "sourceMap": false,
6
- "noImplicitAny": false,
7
- "target": "es2019",
8
- "module": "es2020",
9
- "lib": ["es2019"],
10
- "skipLibCheck": false,
11
- "strict": false,
12
- "esModuleInterop": true,
13
- "allowJs": true,
14
- "moduleResolution": "node",
15
- "typeRoots": [],
16
- "forceConsistentCasingInFileNames": true,
17
- "declaration": true,
18
- "types": ["@fastly/js-compute"],
19
- "allowSyntheticDefaultImports": true,
20
- },
21
- "exclude": ["node_modules"],
22
- "include": [
23
- "src/**/*.ts"
24
- ]
25
- }