Skip to content

[BUG] Import issue on ES5 target, ES2020/DOM libs. #9

Description

@Krelsis

Description:

Installing this module with specific ts targets/libs will cause compile errors.

Replication steps:

  1. Create a new react app with typescript.
  2. Apply TSConfig similar to below.
  3. Make any necessary changes to ensure the app is building and serving/compiling properly.
  4. Install react-progress-bar-timer.
  5. Serve/debug the application.
  6. Observe a compile error.

Recommended solution:

Consider removing type from the dereferenced import in ProgressTimer.d.ts, resulting in : import { ProgressTimerProps, ProgressTimerHandle } from './ProgressTimer.types';

TSConfig

"target": "ES5",
"strict": true,
"module": "esnext",
"moduleResolution": "node",
"lib": [
	"ES2020",
	"DOM"
],

The Error :

...../node_modules/react-progress-bar-timer/dist/components/ProgressTimer.d.ts
TypeScript error in ....../node_modules/react-progress-bar-timer/dist/components/ProgressTimer.d.ts(2,15):
',' expected.  TS1005

    1 | /// <reference types="react" />
  > 2 | import { type ProgressTimerProps, type ProgressTimerHandle } from './ProgressTimer.types';
      |           ^
    3 | declare const ProgressTimer: import("react").ForwardRefExoticComponent<ProgressTimerProps & import("react").RefAttributes<ProgressTimerHandle>>;
    4 | export default ProgressTimer;
    5 |

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions