Uploaded image for project: 'Red Hat 3scale API Management'
  1. Red Hat 3scale API Management
  2. THREESCALE-9693

TSC detect type error whereas webpacker does not

    XMLWordPrintable

Details

    • Task
    • Resolution: Unresolved
    • Major
    • None
    • None
    • System
    • None
    • False
    • None
    • False
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started

    Description

      This may be hard to reproduce. In local, jest passes, even thought there is a transpilation error in NoMatchFound.tsx after upgrading @patternfly/react-icons.

      Affected commit is 6fa49dbc986d977b682d3ab3d7a95c8416ef9fc6.

      Running typescript compilator locally:

      $ yarn tsc --project tsconfig.json --noEmit --skipLibCheck
      
      yarn run v1.22.19
      $ /Users/jgallaso/projects/3scale/porta/node_modules/.bin/tsc --project tsconfig.json --noEmit --skipLibCheck
      app/javascript/src/Common/components/NoMatchFound.tsx:22:27 - error TS2352: Conversion of type 'ComponentClass<SVGIconProps, any>' to type 'FunctionComponent<{}>' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
        Type 'ComponentClass<SVGIconProps, any>' provides no match for the signature '(props: {}, context?: any): ReactElement<any, any> | null'.
      
      22     <EmptyStateIcon icon={SearchIcon as FunctionComponent} />
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      
      Found 1 error in app/javascript/src/Common/components/NoMatchFound.tsx:22
      
      error Command failed with exit code 2.
      info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
      

      It throws the same error as jest in Circleci (see build https://app.circleci.com/pipelines/github/3scale/porta/24460/workflows/82515c3a-cfaa-4501-a789-edff90ca3ec9/jobs/275029)

      However it does not throw in local:

      yarn jest spec/javascripts/Common/components/NoMatchFound.spec.tsx
      yarn run v1.22.19
      $ /Users/jgallaso/projects/3scale/porta/node_modules/.bin/jest spec/javascripts/Common/components/NoMatchFound.spec.tsx
       PASS  spec/javascripts/Common/components/NoMatchFound.spec.tsx
        ✓ should render itself (15 ms)
        ✓ should not render a button (7 ms)
        with an All Filter Clear button
          ✓ should render a button (4 ms)
          ✓ should invoke the callback (4 ms)
      
      Test Suites: 1 passed, 1 total
      Tests:       4 passed, 4 total
      Snapshots:   0 total
      Time:        4.213 s
      Ran all test suites matching /spec\/javascripts\/Common\/components\/NoMatchFound.spec.tsx/i.
      ✨  Done in 4.96s.
      

      And neither does running bin/webpacker and bin/webpacker-dev-server.

      Interestingly enough, running rails assets:precompile do throw the error.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jgallaso Jose Miguel Gallas Olmedo
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated: