diff --git a/docs/blog/version-5.0-release-notes.md b/docs/blog/version-5.0-release-notes.md index 701bc0b421..08ca0fdbab 100644 --- a/docs/blog/version-5.0-release-notes.md +++ b/docs/blog/version-5.0-release-notes.md @@ -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. diff --git a/docs/docs/common/graphql.md b/docs/docs/common/graphql.md index b6de5a7128..b7806cd1c6 100644 --- a/docs/docs/common/graphql.md +++ b/docs/docs/common/graphql.md @@ -194,7 +194,7 @@ export class ApiController extends GraphQLController { schema = // ... @dependency - resolvers: RootResolverService; + declare resolvers: RootResolverService; } ``` diff --git a/packages/acceptance-tests/tsconfig.json b/packages/acceptance-tests/tsconfig.json index b3f56375cf..9e17c26a09 100644 --- a/packages/acceptance-tests/tsconfig.json +++ b/packages/acceptance-tests/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "outDir": "lib/", "module": "commonjs", - "target": "es2021", + "target": "es2023", "emitDecoratorMetadata": true, "experimentalDecorators": true, "strict": true, @@ -15,7 +15,7 @@ "../../node_modules/@types", ], "lib": [ - "es2021", + "es2023", "dom" ], "jsx": "react" diff --git a/packages/aws-s3/tsconfig.json b/packages/aws-s3/tsconfig.json index dbe86b109b..4be5f16fd3 100644 --- a/packages/aws-s3/tsconfig.json +++ b/packages/aws-s3/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "outDir": "lib/", "module": "commonjs", - "target": "es2021", + "target": "es2023", "emitDecoratorMetadata": true, "experimentalDecorators": true, "strict": true, @@ -15,7 +15,7 @@ "../../node_modules/@types", ], "lib": [ - "es2021", + "es2023", "dom" ] }, diff --git a/packages/cli/src/generate/specs/app/tsconfig.json b/packages/cli/src/generate/specs/app/tsconfig.json index 4debd03ca5..37b1c195a3 100644 --- a/packages/cli/src/generate/specs/app/tsconfig.json +++ b/packages/cli/src/generate/specs/app/tsconfig.json @@ -8,10 +8,10 @@ "noImplicitAny": false, "strictPropertyInitialization": false, "module": "commonjs", - "target": "es2021", + "target": "es2023", "rootDir": "src", "lib": [ - "es2021", + "es2023", "dom" ] }, diff --git a/packages/cli/src/generate/templates/app/tsconfig.json b/packages/cli/src/generate/templates/app/tsconfig.json index 4debd03ca5..37b1c195a3 100644 --- a/packages/cli/src/generate/templates/app/tsconfig.json +++ b/packages/cli/src/generate/templates/app/tsconfig.json @@ -8,10 +8,10 @@ "noImplicitAny": false, "strictPropertyInitialization": false, "module": "commonjs", - "target": "es2021", + "target": "es2023", "rootDir": "src", "lib": [ - "es2021", + "es2023", "dom" ] }, diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json index 51674d2393..249a647247 100644 --- a/packages/cli/tsconfig.json +++ b/packages/cli/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "outDir": "lib/", "module": "commonjs", - "target": "es2021", + "target": "es2023", "emitDecoratorMetadata": true, "experimentalDecorators": true, "strict": true, @@ -15,7 +15,7 @@ "../../node_modules/@types", ], "lib": [ - "es2021", + "es2023", "dom" ] }, diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json index dbe86b109b..4be5f16fd3 100644 --- a/packages/core/tsconfig.json +++ b/packages/core/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "outDir": "lib/", "module": "commonjs", - "target": "es2021", + "target": "es2023", "emitDecoratorMetadata": true, "experimentalDecorators": true, "strict": true, @@ -15,7 +15,7 @@ "../../node_modules/@types", ], "lib": [ - "es2021", + "es2023", "dom" ] }, diff --git a/packages/examples/src/app/entities/user.entity.ts b/packages/examples/src/app/entities/user.entity.ts index ecbd75d7fa..838ab0d429 100644 --- a/packages/examples/src/app/entities/user.entity.ts +++ b/packages/examples/src/app/entities/user.entity.ts @@ -1,4 +1,4 @@ -import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm'; +import { Column, Entity } from 'typeorm'; import { hashPassword } from '@foal/core'; import { UserWithPermissions } from '@foal/typeorm'; @@ -6,9 +6,6 @@ import { UserWithPermissions } from '@foal/typeorm'; @Entity() export class User extends UserWithPermissions { - @PrimaryGeneratedColumn() - id: number; - @Column({ unique: true }) email: string; diff --git a/packages/examples/tsconfig.json b/packages/examples/tsconfig.json index d10b194fab..0e8956d45a 100644 --- a/packages/examples/tsconfig.json +++ b/packages/examples/tsconfig.json @@ -3,7 +3,7 @@ "outDir": "build", "sourceMap": true, "module": "commonjs", - "target": "es2021", + "target": "es2023", "emitDecoratorMetadata": true, "experimentalDecorators": true, "strictNullChecks": true, @@ -15,7 +15,7 @@ "../../node_modules/@types", ], "lib": [ - "es2021", + "es2023", "dom", "ESNext.AsyncIterable" ] diff --git a/packages/graphiql/tsconfig.json b/packages/graphiql/tsconfig.json index dbe86b109b..4be5f16fd3 100644 --- a/packages/graphiql/tsconfig.json +++ b/packages/graphiql/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "outDir": "lib/", "module": "commonjs", - "target": "es2021", + "target": "es2023", "emitDecoratorMetadata": true, "experimentalDecorators": true, "strict": true, @@ -15,7 +15,7 @@ "../../node_modules/@types", ], "lib": [ - "es2021", + "es2023", "dom" ] }, diff --git a/packages/graphql/src/acceptance-test.spec.ts b/packages/graphql/src/acceptance-test.spec.ts index dcc809af5e..dde032fcec 100644 --- a/packages/graphql/src/acceptance-test.spec.ts +++ b/packages/graphql/src/acceptance-test.spec.ts @@ -70,7 +70,7 @@ describe('[Acceptance test] GraphQLController', () => { schema = buildSchema(typeDefs); @dependency - resolvers: AppResolver; + declare resolvers: AppResolver; } class AppController { @@ -109,7 +109,7 @@ describe('[Acceptance test] GraphQLController', () => { schema = schemaFromTypeGlob('./test-dir/*.graphql'); @dependency - resolvers: AppResolver; + declare resolvers: AppResolver; } class AppController { @@ -158,7 +158,7 @@ describe('[Acceptance test] GraphQLController', () => { schema = buildSchema(typeDefs); @dependency - resolvers: Resolvers; + declare resolvers: Resolvers; } class AppController { diff --git a/packages/graphql/tsconfig.json b/packages/graphql/tsconfig.json index 10860f5077..bf9eb7fea0 100644 --- a/packages/graphql/tsconfig.json +++ b/packages/graphql/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "outDir": "lib/", "module": "commonjs", - "target": "es2021", + "target": "es2023", "emitDecoratorMetadata": true, "experimentalDecorators": true, "strict": true, @@ -15,7 +15,7 @@ "../../node_modules/@types", ], "lib": [ - "es2021", + "es2023", "dom", "ESNext.AsyncIterable" ] diff --git a/packages/internal-test/tsconfig.json b/packages/internal-test/tsconfig.json index dbe86b109b..4be5f16fd3 100644 --- a/packages/internal-test/tsconfig.json +++ b/packages/internal-test/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "outDir": "lib/", "module": "commonjs", - "target": "es2021", + "target": "es2023", "emitDecoratorMetadata": true, "experimentalDecorators": true, "strict": true, @@ -15,7 +15,7 @@ "../../node_modules/@types", ], "lib": [ - "es2021", + "es2023", "dom" ] }, diff --git a/packages/jwks-rsa/tsconfig.json b/packages/jwks-rsa/tsconfig.json index dbe86b109b..4be5f16fd3 100644 --- a/packages/jwks-rsa/tsconfig.json +++ b/packages/jwks-rsa/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "outDir": "lib/", "module": "commonjs", - "target": "es2021", + "target": "es2023", "emitDecoratorMetadata": true, "experimentalDecorators": true, "strict": true, @@ -15,7 +15,7 @@ "../../node_modules/@types", ], "lib": [ - "es2021", + "es2023", "dom" ] }, diff --git a/packages/jwt/tsconfig.json b/packages/jwt/tsconfig.json index dbe86b109b..4be5f16fd3 100644 --- a/packages/jwt/tsconfig.json +++ b/packages/jwt/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "outDir": "lib/", "module": "commonjs", - "target": "es2021", + "target": "es2023", "emitDecoratorMetadata": true, "experimentalDecorators": true, "strict": true, @@ -15,7 +15,7 @@ "../../node_modules/@types", ], "lib": [ - "es2021", + "es2023", "dom" ] }, diff --git a/packages/mongodb/tsconfig.json b/packages/mongodb/tsconfig.json index 282ee38efd..3bbf030a35 100644 --- a/packages/mongodb/tsconfig.json +++ b/packages/mongodb/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "outDir": "lib/", "module": "commonjs", - "target": "es2021", + "target": "es2023", "emitDecoratorMetadata": true, "experimentalDecorators": true, "strict": true, @@ -15,7 +15,7 @@ "../../node_modules/@types", ], "lib": [ - "es2021", + "es2023", "dom" ], "types": [ diff --git a/packages/password/tsconfig.json b/packages/password/tsconfig.json index 282ee38efd..3bbf030a35 100644 --- a/packages/password/tsconfig.json +++ b/packages/password/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "outDir": "lib/", "module": "commonjs", - "target": "es2021", + "target": "es2023", "emitDecoratorMetadata": true, "experimentalDecorators": true, "strict": true, @@ -15,7 +15,7 @@ "../../node_modules/@types", ], "lib": [ - "es2021", + "es2023", "dom" ], "types": [ diff --git a/packages/redis/tsconfig.json b/packages/redis/tsconfig.json index 282ee38efd..3bbf030a35 100644 --- a/packages/redis/tsconfig.json +++ b/packages/redis/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "outDir": "lib/", "module": "commonjs", - "target": "es2021", + "target": "es2023", "emitDecoratorMetadata": true, "experimentalDecorators": true, "strict": true, @@ -15,7 +15,7 @@ "../../node_modules/@types", ], "lib": [ - "es2021", + "es2023", "dom" ], "types": [ diff --git a/packages/social/tsconfig.json b/packages/social/tsconfig.json index dbe86b109b..4be5f16fd3 100644 --- a/packages/social/tsconfig.json +++ b/packages/social/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "outDir": "lib/", "module": "commonjs", - "target": "es2021", + "target": "es2023", "emitDecoratorMetadata": true, "experimentalDecorators": true, "strict": true, @@ -15,7 +15,7 @@ "../../node_modules/@types", ], "lib": [ - "es2021", + "es2023", "dom" ] }, diff --git a/packages/socket.io/tsconfig.json b/packages/socket.io/tsconfig.json index 282ee38efd..3bbf030a35 100644 --- a/packages/socket.io/tsconfig.json +++ b/packages/socket.io/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "outDir": "lib/", "module": "commonjs", - "target": "es2021", + "target": "es2023", "emitDecoratorMetadata": true, "experimentalDecorators": true, "strict": true, @@ -15,7 +15,7 @@ "../../node_modules/@types", ], "lib": [ - "es2021", + "es2023", "dom" ], "types": [ diff --git a/packages/storage/tsconfig.json b/packages/storage/tsconfig.json index dbe86b109b..4be5f16fd3 100644 --- a/packages/storage/tsconfig.json +++ b/packages/storage/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "outDir": "lib/", "module": "commonjs", - "target": "es2021", + "target": "es2023", "emitDecoratorMetadata": true, "experimentalDecorators": true, "strict": true, @@ -15,7 +15,7 @@ "../../node_modules/@types", ], "lib": [ - "es2021", + "es2023", "dom" ] }, diff --git a/packages/swagger/tsconfig.json b/packages/swagger/tsconfig.json index dbe86b109b..4be5f16fd3 100644 --- a/packages/swagger/tsconfig.json +++ b/packages/swagger/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "outDir": "lib/", "module": "commonjs", - "target": "es2021", + "target": "es2023", "emitDecoratorMetadata": true, "experimentalDecorators": true, "strict": true, @@ -15,7 +15,7 @@ "../../node_modules/@types", ], "lib": [ - "es2021", + "es2023", "dom" ] }, diff --git a/packages/typeorm/tsconfig.json b/packages/typeorm/tsconfig.json index dbe86b109b..4be5f16fd3 100644 --- a/packages/typeorm/tsconfig.json +++ b/packages/typeorm/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "outDir": "lib/", "module": "commonjs", - "target": "es2021", + "target": "es2023", "emitDecoratorMetadata": true, "experimentalDecorators": true, "strict": true, @@ -15,7 +15,7 @@ "../../node_modules/@types", ], "lib": [ - "es2021", + "es2023", "dom" ] }, diff --git a/packages/typestack/tsconfig.json b/packages/typestack/tsconfig.json index dbe86b109b..4be5f16fd3 100644 --- a/packages/typestack/tsconfig.json +++ b/packages/typestack/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "outDir": "lib/", "module": "commonjs", - "target": "es2021", + "target": "es2023", "emitDecoratorMetadata": true, "experimentalDecorators": true, "strict": true, @@ -15,7 +15,7 @@ "../../node_modules/@types", ], "lib": [ - "es2021", + "es2023", "dom" ] }, diff --git a/tsconfig.json b/tsconfig.json index 9c91f1d6a3..f317f2ed8d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,7 @@ "outDir": "./lib/", "baseUrl": ".", "module": "commonjs", - "target": "es2021", + "target": "es2023", "emitDecoratorMetadata": true, "experimentalDecorators": true, "strict": true, @@ -11,7 +11,7 @@ "sourceMap": true, "declaration": true, "lib": [ - "es2021", + "es2023", "dom" ] },