Skip to content

Commit

Permalink
Merge pull request #1286 from FoalTS/compile-to-es2023
Browse files Browse the repository at this point in the history
Compile to ES2023
  • Loading branch information
LoicPoullain authored Aug 22, 2024
2 parents cd0246a + 79e40c0 commit aacc37a
Show file tree
Hide file tree
Showing 26 changed files with 61 additions and 53 deletions.
13 changes: 12 additions & 1 deletion docs/blog/version-5.0-release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,20 @@ Version 5.0 of [Foal](https://foalts.org/) is out!

## Supported versions of Node and TypeScript

- Support for Node 18 has been dropped and support for Node 22 has been added.
- Support for Node 18 has been dropped and support for Node 22 has been added. Foal code is now compiled to ES2023.
- The supported version of TypeScript is version 5. Update your `package.json` file accordingly.

> If you're using the `GraphQLController` with the `resolvers` property, you need to add the `declare` keyword before the property name:
> ```typescript
>
> export class ApiController extends GraphQLController {
> schema = // ...
>
> @dependency
> declare resolvers: RootResolverService;
> }
> ```
## Better typing
- The default type of `Context.state` is now `{}`. This way, you'll get a compilation error if you forget to specify a type for the state.
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/common/graphql.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export class ApiController extends GraphQLController {
schema = // ...
@dependency
resolvers: RootResolverService;
declare resolvers: RootResolverService;
}
```
Expand Down
4 changes: 2 additions & 2 deletions packages/acceptance-tests/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"outDir": "lib/",
"module": "commonjs",
"target": "es2021",
"target": "es2023",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"strict": true,
Expand All @@ -15,7 +15,7 @@
"../../node_modules/@types",
],
"lib": [
"es2021",
"es2023",
"dom"
],
"jsx": "react"
Expand Down
4 changes: 2 additions & 2 deletions packages/aws-s3/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"outDir": "lib/",
"module": "commonjs",
"target": "es2021",
"target": "es2023",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"strict": true,
Expand All @@ -15,7 +15,7 @@
"../../node_modules/@types",
],
"lib": [
"es2021",
"es2023",
"dom"
]
},
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/generate/specs/app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"noImplicitAny": false,
"strictPropertyInitialization": false,
"module": "commonjs",
"target": "es2021",
"target": "es2023",
"rootDir": "src",
"lib": [
"es2021",
"es2023",
"dom"
]
},
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/generate/templates/app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"noImplicitAny": false,
"strictPropertyInitialization": false,
"module": "commonjs",
"target": "es2021",
"target": "es2023",
"rootDir": "src",
"lib": [
"es2021",
"es2023",
"dom"
]
},
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"outDir": "lib/",
"module": "commonjs",
"target": "es2021",
"target": "es2023",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"strict": true,
Expand All @@ -15,7 +15,7 @@
"../../node_modules/@types",
],
"lib": [
"es2021",
"es2023",
"dom"
]
},
Expand Down
4 changes: 2 additions & 2 deletions packages/core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"outDir": "lib/",
"module": "commonjs",
"target": "es2021",
"target": "es2023",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"strict": true,
Expand All @@ -15,7 +15,7 @@
"../../node_modules/@types",
],
"lib": [
"es2021",
"es2023",
"dom"
]
},
Expand Down
5 changes: 1 addition & 4 deletions packages/examples/src/app/entities/user.entity.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
import { Column, Entity } from 'typeorm';

import { hashPassword } from '@foal/core';
import { UserWithPermissions } from '@foal/typeorm';

@Entity()
export class User extends UserWithPermissions {

@PrimaryGeneratedColumn()
id: number;

@Column({ unique: true })
email: string;

Expand Down
4 changes: 2 additions & 2 deletions packages/examples/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"outDir": "build",
"sourceMap": true,
"module": "commonjs",
"target": "es2021",
"target": "es2023",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"strictNullChecks": true,
Expand All @@ -15,7 +15,7 @@
"../../node_modules/@types",
],
"lib": [
"es2021",
"es2023",
"dom",
"ESNext.AsyncIterable"
]
Expand Down
4 changes: 2 additions & 2 deletions packages/graphiql/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"outDir": "lib/",
"module": "commonjs",
"target": "es2021",
"target": "es2023",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"strict": true,
Expand All @@ -15,7 +15,7 @@
"../../node_modules/@types",
],
"lib": [
"es2021",
"es2023",
"dom"
]
},
Expand Down
6 changes: 3 additions & 3 deletions packages/graphql/src/acceptance-test.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('[Acceptance test] GraphQLController', () => {
schema = buildSchema(typeDefs);

@dependency
resolvers: AppResolver;
declare resolvers: AppResolver;
}

class AppController {
Expand Down Expand Up @@ -109,7 +109,7 @@ describe('[Acceptance test] GraphQLController', () => {
schema = schemaFromTypeGlob('./test-dir/*.graphql');

@dependency
resolvers: AppResolver;
declare resolvers: AppResolver;
}

class AppController {
Expand Down Expand Up @@ -158,7 +158,7 @@ describe('[Acceptance test] GraphQLController', () => {
schema = buildSchema(typeDefs);

@dependency
resolvers: Resolvers;
declare resolvers: Resolvers;
}

class AppController {
Expand Down
4 changes: 2 additions & 2 deletions packages/graphql/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"outDir": "lib/",
"module": "commonjs",
"target": "es2021",
"target": "es2023",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"strict": true,
Expand All @@ -15,7 +15,7 @@
"../../node_modules/@types",
],
"lib": [
"es2021",
"es2023",
"dom",
"ESNext.AsyncIterable"
]
Expand Down
4 changes: 2 additions & 2 deletions packages/internal-test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"outDir": "lib/",
"module": "commonjs",
"target": "es2021",
"target": "es2023",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"strict": true,
Expand All @@ -15,7 +15,7 @@
"../../node_modules/@types",
],
"lib": [
"es2021",
"es2023",
"dom"
]
},
Expand Down
4 changes: 2 additions & 2 deletions packages/jwks-rsa/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"outDir": "lib/",
"module": "commonjs",
"target": "es2021",
"target": "es2023",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"strict": true,
Expand All @@ -15,7 +15,7 @@
"../../node_modules/@types",
],
"lib": [
"es2021",
"es2023",
"dom"
]
},
Expand Down
4 changes: 2 additions & 2 deletions packages/jwt/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"outDir": "lib/",
"module": "commonjs",
"target": "es2021",
"target": "es2023",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"strict": true,
Expand All @@ -15,7 +15,7 @@
"../../node_modules/@types",
],
"lib": [
"es2021",
"es2023",
"dom"
]
},
Expand Down
4 changes: 2 additions & 2 deletions packages/mongodb/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"outDir": "lib/",
"module": "commonjs",
"target": "es2021",
"target": "es2023",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"strict": true,
Expand All @@ -15,7 +15,7 @@
"../../node_modules/@types",
],
"lib": [
"es2021",
"es2023",
"dom"
],
"types": [
Expand Down
4 changes: 2 additions & 2 deletions packages/password/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"outDir": "lib/",
"module": "commonjs",
"target": "es2021",
"target": "es2023",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"strict": true,
Expand All @@ -15,7 +15,7 @@
"../../node_modules/@types",
],
"lib": [
"es2021",
"es2023",
"dom"
],
"types": [
Expand Down
4 changes: 2 additions & 2 deletions packages/redis/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"outDir": "lib/",
"module": "commonjs",
"target": "es2021",
"target": "es2023",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"strict": true,
Expand All @@ -15,7 +15,7 @@
"../../node_modules/@types",
],
"lib": [
"es2021",
"es2023",
"dom"
],
"types": [
Expand Down
4 changes: 2 additions & 2 deletions packages/social/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"outDir": "lib/",
"module": "commonjs",
"target": "es2021",
"target": "es2023",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"strict": true,
Expand All @@ -15,7 +15,7 @@
"../../node_modules/@types",
],
"lib": [
"es2021",
"es2023",
"dom"
]
},
Expand Down
4 changes: 2 additions & 2 deletions packages/socket.io/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"outDir": "lib/",
"module": "commonjs",
"target": "es2021",
"target": "es2023",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"strict": true,
Expand All @@ -15,7 +15,7 @@
"../../node_modules/@types",
],
"lib": [
"es2021",
"es2023",
"dom"
],
"types": [
Expand Down
4 changes: 2 additions & 2 deletions packages/storage/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"outDir": "lib/",
"module": "commonjs",
"target": "es2021",
"target": "es2023",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"strict": true,
Expand All @@ -15,7 +15,7 @@
"../../node_modules/@types",
],
"lib": [
"es2021",
"es2023",
"dom"
]
},
Expand Down
Loading

0 comments on commit aacc37a

Please sign in to comment.