admin管理员组文章数量:1322024
After upgrading from node 23.5.0 to 23.6.0, our Playwright test suites stopped working. It looks like it's related to an "--experimental-strip-types" setting.
We've fixed our code by updating type imports, but we still have problems with enums from the graphql codegen. When the test suite is run, an error appears for each enum in the generated graphql file (examples below).
Is there an environment flag I can set or a config setting I can add to codegen.ts?
Errors sample:
SyntaxError: x TypeScript enum is not supported in strip-only mode
,-[23:1]
20 | UInt: { input: any; output: any; }
21 | };
22 |
23 | ,-> export enum AccountTemplateStatus {
24 | | Active = 'ACTIVE',
25 | | Inactive = 'INACTIVE'
26 | `-> }
27 |
28 | export type ActionItem = {
29 | __typename?: 'ActionItem';
`----
x TypeScript enum is not supported in strip-only mode
,-[69:1]
66 | stateId?: InputMaybe<Scalars['Int']['input']>;
67 | };
68 |
69 | ,-> export enum AdjustmentCode {
70 | | Active = 'ACTIVE',
71 | | Adjusted = 'ADJUSTED',
72 | | Reversal = 'REVERSAL',
73 | | Voided = 'VOIDED'
74 | `-> }
75 |
76 | export enum AdjustmentStatus {
77 | Executed = 'EXECUTED',
`----
codegen.ts:
import './dotenv.js'
module.exports = {
generates: {
'src/generated/our-team-graphql.ts': {
schema: [process.env.GRAPHQL_URL],
plugins: ['typescript', 'typescript-operations', 'typescript-document-nodes'],
overwrite: true,
},
'src/generated/our-mobile-graphql.ts': {
schema: {
[process.env.MOBILE_GRAPHQL_URL]: {
headers: {
Authorization: `${process.env.MOBILE_GRAPHQL_AUTH_HEADER}`,
},
},
},
plugins: ['typescript', 'typescript-operations', 'typescript-document-nodes'],
overwrite: true,
config: {
withMutationFn: true,
withResultType: true,
},
},
},
}
Dependencies from package.json:
"devDependencies": {
"@eslint/js": "^9.15.0",
"@faker-js/faker": "^9.0.0",
"@graphql-eslint/eslint-plugin": "^3.20.1",
"@playwright/test": "^1.36.1",
"apollo-upload-client": "^18.0.1",
"eslint": "^8.57.1",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-playwright": "^2.1.0",
"eslint-plugin-prettier": "^5.2.1",
"husky": "^9.1.5",
"prettier": "3.2.5",
"typescript": "^5.7.2",
"typescript-eslint": "^8.16.0"
},
"dependencies": {
"@alex_neo/playwright-azure-reporter": "^1.12.0",
"@apollo/client": "^3.11.8",
"@dotenvx/dotenvx": "^1.21.1",
"@graphql-codegen/cli": "^5.0.2",
"@graphql-codegen/client-preset": "^4.5.1",
"@graphql-codegen/typescript": "4.0.9",
"@graphql-codegen/typescript-document-nodes": "4.0.9",
"@graphql-codegen/typescript-resolvers": "^4.4.1",
"@graphql-codegen/typescript-type-graphql": "^3.0.0",
"@graphql-typed-document-node/core": "^3.2.0",
"@swc/types": "^0.1.17",
"@types/luxon": "^3.4.2",
"@types/prop-types": "^15.7.12",
"@types/react": "^18.3.5",
"@types/shelljs": "^0.8.15",
"@typescript-eslint/parser": "^7.9.0",
"csv-parse": "^5.5.6",
"currency-master": "^1.1.0",
"date-fns": "^3.6.0",
"detect-secrets": "^1.0.6",
"dotenv": "^16.4.5",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.3",
"glob": "^11.0.0",
"graphql": "^16.9.0",
"graphql-upload": "^17.0.0",
"luxon": "^3.5.0",
"npm": "^10.5.2",
"pdf-parse": "^1.1.1",
"playwright": "^1.47.0",
"shelljs": "^0.8.5"
}
本文标签:
版权声明:本文标题:node.js - Codegen enums trigger error "Typescript enum is not supported in strip-only mode" after updating nod 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742111184a2421263.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论