You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, as a user of your package this won't work as there is no way for a user's TypeScript compiler to know what @models/ means (your tsconfig isn't part of the bundle and even if it would, I don't think it would help).
As a result, there is no TypeScript support for props of <Chrono> component.
To Reproduce
create a React project with TypeScript support
Add <Chrono> component
Use some invalid props, e.g. <Chrono iteams={...} mode="Something"> --> typo in "items" and invalid value for mode
Run TSC. It won't complain even through the props aren't valid
I've tested with version 2.3.1
Expected behavior
It should be possible to strictly check the Props of the <Chrono> component (and maybe others too?) with TypeScript.
I see two options to solve this (maybe there are more):
a) use relative paths in your code base instead of aliases
b) adjusting your build process so that aliases are resolved and replaced with a relative path at build time.
The first option seems to be used in some of your code base, e.g. src/react-chrono.ts is doing import { TimelineItemModel } from './models/TimelineItemModel';
which results in correctly working types in the bundle.
I'm happy to provide a PR but you have to decide which solution you want to have.
The text was updated successfully, but these errors were encountered:
In your bundle in
dist/components/index.d.ts
there is this line:import { TimelineProps } from '@models/TimelineModel';
@models/*
is an alias defined in your tsconfig.However, as a user of your package this won't work as there is no way for a user's TypeScript compiler to know what
@models/
means (your tsconfig isn't part of the bundle and even if it would, I don't think it would help).As a result, there is no TypeScript support for props of
<Chrono>
component.To Reproduce
<Chrono>
component<Chrono iteams={...} mode="Something">
--> typo in "items" and invalid value formode
I've tested with version 2.3.1
Expected behavior
It should be possible to strictly check the Props of the
<Chrono>
component (and maybe others too?) with TypeScript.I see two options to solve this (maybe there are more):
a) use relative paths in your code base instead of aliases
b) adjusting your build process so that aliases are resolved and replaced with a relative path at build time.
The first option seems to be used in some of your code base, e.g. src/react-chrono.ts is doing
import { TimelineItemModel } from './models/TimelineItemModel';
which results in correctly working types in the bundle.
I'm happy to provide a PR but you have to decide which solution you want to have.
The text was updated successfully, but these errors were encountered: