Skip to content
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

Fix reporter and mock types #299

Merged
merged 7 commits into from
Jan 13, 2024

Conversation

lieutdan13
Copy link
Contributor

I discovered an issue where the types on the ExercisedInteraction interface didn't match the Interaction interface it extends. See the issue below when running tsc. I've resolved this by creating a few super class interfaces with more broad types, but the child classes have more defined types.

> tsc

src/exports/reporter.d.ts:23:18 - error TS2430: Interface 'ExercisedInteraction' incorrectly extends interface 'Interaction'.
  Types of property 'calls' are incompatible.
    Type 'import("C:/Users/dansc/projects/pactum/src/exports/reporter").InteractionCall[]' is not assignable to type 'import("C:/Users/dansc/projects/pactum/src/exports/mock").InteractionCall[]'.
      Type 'import("C:/Users/dansc/projects/pactum/src/exports/reporter").InteractionCall' is not assignable to type 'import("C:/Users/dansc/projects/pactum/src/exports/mock").InteractionCall'.
        The types of 'request.headers' are incompatible between these types.
          Type 'object' is not assignable to type '{ [key: string]: unknown; }'.
            Index signature for type 'string' is missing in type '{}'.

23 export interface ExercisedInteraction extends Interaction {
                    ~~~~~~~~~~~~~~~~~~~~


Found 1 error in src/exports/reporter.d.ts:23

In addition to fixing the types, I've also added eslint and typescript related packages to the dev dependencies to support the npm run lint and the new npm run build scripts.

@ASaiAnudeep ASaiAnudeep merged commit da2bbb5 into pactumjs:master Jan 13, 2024
12 checks passed
@lieutdan13 lieutdan13 deleted the fix-reporter-types branch January 13, 2024 23:01
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.

None yet

2 participants