Skip to content

fix: TS complains when initializing codeceptjs #3400

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

kobenguyent
Copy link
Collaborator

Motivation/Description of the PR

  • This PR solves this error
TSError: ⨯ Unable to compile TypeScript:
codecept.conf.ts:1:51 - error TS7016: Could not find a declaration file for module '@codeceptjs/configure'. '/Users/tamara-thanh/Desktop/codeceptjs-rest-demo/node_modules/@codeceptjs/configure/index.js' implicitly has an 'any' type.
  Try `npm install @types/codeceptjs__configure` if it exists or add a new declaration (.d.ts) file containing `declare module '@codeceptjs/configure';`

1 import { setHeadlessWhen, setCommonPlugins } from '@codeceptjs/configure';
                                                    ~~~~~~~~~~~~~~~~~~~~~~~

    at createTSError (/Users/tamara-thanh/Desktop/codeceptjs-rest-demo/node_modules/ts-node/src/index.ts:434:12)
    at reportTSError (/Users/tamara-thanh/Desktop/codeceptjs-rest-demo/node_modules/ts-node/src/index.ts:438:19)
    at getOutput (/Users/tamara-thanh/Desktop/codeceptjs-rest-demo/node_modules/ts-node/src/index.ts:578:36)
    at Object.compile (/Users/tamara-thanh/Desktop/codeceptjs-rest-demo/node_modules/ts-node/src/index.ts:775:32)
    at Module.m._compile (/Users/tamara-thanh/Desktop/codeceptjs-rest-demo/node_modules/ts-node/src/index.ts:858:43)
    at Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Object.require.extensions.<computed> [as .ts] (/Users/tamara-thanh/Desktop/codeceptjs-rest-demo/node_modules/ts-node/src/index.ts:861:12)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)

Type of change

  • 🐛 Bug fix

@DavertMik
Copy link
Contributor

Can we still use import here?
Maybe if we export types from codeceptjs/confgure?

@kobenguyent
Copy link
Collaborator Author

I supposed so if you expose types from configure project

@DavertMik
Copy link
Contributor

Probably this should be done instead

@kobenguyent
Copy link
Collaborator Author

Done in here codeceptjs/configure#30 @DavertMik

@kobenguyent kobenguyent deleted the improve-init-script branch August 30, 2022 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants