Skip to content

Commit

Permalink
TypeScript 4.1 (#269)
Browse files Browse the repository at this point in the history
Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Ryan Ling <[email protected]>
  • Loading branch information
3 people authored Nov 23, 2020
1 parent da45f2d commit 8158e01
Show file tree
Hide file tree
Showing 8 changed files with 1,408 additions and 1,294 deletions.
9 changes: 9 additions & 0 deletions .changeset/fluffy-poets-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'skuba': minor
---

**deps:** TypeScript 4.1

This includes formatting and linting support for new syntax features.

See the [release notes](https://devblogs.microsoft.com/typescript/announcing-typescript-4-1) for more information.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
"concurrently": "^5.3.0",
"ejs": "^3.1.5",
"enquirer": "^2.3.6",
"eslint": "^7.11.0",
"eslint-config-skuba": "1.0.8",
"eslint": "^7.14.0",
"eslint-config-skuba": "1.0.9",
"execa": "^4.0.3",
"fs-extra": "^9.0.1",
"get-port": "^5.1.1",
Expand All @@ -78,7 +78,7 @@
"ts-node": "^9.0.0",
"ts-node-dev": "1.0.0-pre.63",
"tsconfig-seek": "1.0.2",
"typescript": "4.0.5",
"typescript": "4.1.2",
"yargs-parser": "^20.2.3"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/api/net/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const pollSocket = async (host: string, port: number, timeout: number) =>
clearTimeout(intervalId);
clearTimeout(timeoutId);

resolve();
resolve(undefined);
};

const intervalId = setInterval(() => {
Expand Down
51 changes: 27 additions & 24 deletions src/cli/lint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* and new syntax features.
*/

/* eslint-disable jest/no-commented-out-tests, jest/no-disabled-tests */

import './lint';

describe('TypeScript', () => {
Expand Down Expand Up @@ -47,27 +45,32 @@ describe('TypeScript', () => {
});
});

describe.skip('4.1', () => {
// test('Template Literal Types', () => {
// type Color = 'red' | 'blue';
// type Quantity = 'one' | 'two';
// type SeussFish = `${Quantity | Color} fish`;
// const seussFish: SeussFish = 'red blue fish';
// expect(seussFish).toBeDefined();
// });
// test('Key Remapping in Mapped Types', () => {
// type RemoveKindField<T> = {
// [K in keyof T as Exclude<K, "kind">]: T[K];
// };
// interface Circle {
// kind: 'circle';
// radius: number;
// }
// type KindlessCircle = RemoveKindField<Circle>;
// const kindlessCircle: KindlessCircle = {
// radius: 0,
// };
// expect(kindlessCircle).toBeDefined();
// });
describe('4.1', () => {
test('Template Literal Types', () => {
type Color = 'red' | 'blue';
type Quantity = 'one' | 'two';
type SeussFish = `${Quantity | Color} fish`;

const seussFish: SeussFish = 'red fish';

expect(seussFish).toBeDefined();
});

test('Key Remapping in Mapped Types', () => {
type RemoveKindField<T> = {
[K in keyof T as Exclude<K, 'kind'>]: T[K];
};
interface Circle {
kind: 'circle';
radius: number;
}
type KindlessCircle = RemoveKindField<Circle>;

const kindlessCircle: KindlessCircle = {
radius: 0,
};

expect(kindlessCircle).toBeDefined();
});
});
});
4 changes: 1 addition & 3 deletions template/koa-rest-api/src/framework/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ const version = VersionMiddleware.create({
version: config.version,
});

export const createApp = <State, Context>(
...middleware: Middleware<State, Context>[]
) =>
export const createApp = <S, C>(...middleware: Middleware<S, C>[]) =>
new Koa()
.use(requestLogging)
.use(metrics)
Expand Down
2 changes: 1 addition & 1 deletion template/koa-rest-api/src/framework/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const validate = <T>({
}: {
ctx: Context;
input: unknown;
filter: (input: unknown) => T;
filter: (data: unknown) => T;
}) => {
try {
return filter(input);
Expand Down
2 changes: 1 addition & 1 deletion template/lambda-sqs-worker/src/framework/validation.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const validateJson = <T>(input: string, filter: (input: unknown) => T) =>
export const validateJson = <T>(input: string, filter: (data: unknown) => T) =>
filter(JSON.parse(input));
Loading

0 comments on commit 8158e01

Please sign in to comment.