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

Upgrading from 4.10.1 to 5.0.0: history/index"' has no exported member 'LocationState'. TS2694 #835

Closed
tomaszs opened this issue Oct 14, 2020 · 4 comments

Comments

@tomaszs
Copy link

tomaszs commented Oct 14, 2020

Upgrading from 4.10.1 to 5.0.0 causes:

Namespace '"C:/myurl/node_modules/history/index"' has no exported member 'LocationState'.  TS2694

    53 | export class HashRouter extends React.Component<HashRouterProps, any> {}
    54 |
  > 55 | export interface LinkProps<S = H.LocationState> extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
       |                                  ^
    56 |     component?: React.ComponentType<any>;
    57 |     to: H.LocationDescriptor<S> | ((location: H.Location<S>) => H.LocationDescriptor<S>);
    58 |     replace?: boolean;

Seems like an internal bug

@dl748
Copy link

dl748 commented Feb 27, 2021

That type doesn't exist? I see H.LocationDescriptor in your code as well. These looks like types from @types/history... history contains its own types.

Location is defined https://github.com/ReactTraining/history/blob/28c89f4091ae9e1b0001341ea60c629674e83627/packages/history/index.ts#L99

@gauravshah27
Copy link

I am seeing the same issue with LocationState and I am not using @types/history package on my project. Is there a recommended migration path away from LocationState ?

@mjackson
Copy link
Member

The type definitions in @types/history are for v4. v5 comes with its own type definitions, so you don't need @types/history anymore.

@jasonferrier
Copy link

jasonferrier commented Aug 29, 2023

FYI - for anyone still hitting this page in the search results, changing the import & type from LocationState to Location worked for me.

I'm using History v5.0.1.

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

No branches or pull requests

5 participants