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

Parsing error: Unexpected token on declate export class BrowserRouter #242

Closed
NameFILIP opened this issue Jun 16, 2017 · 5 comments
Closed

Comments

@NameFILIP
Copy link

After installing a libdef with flow-typed:

flow-typed install react-router-dom@4

I'm getting an error:

/<project-folder>/flow-typed/npm/react-router-dom_v4.x.x.js
  5:11  error  Parsing error: Unexpected token

  3 | 
  4 | declare module 'react-router-dom' {
> 5 |   declare export class BrowserRouter extends React$Component {
    |           ^
  6 |     props: {
  7 |       basename?: string,
  8 |       forceRefresh?: boolean,

I think it doesn't like the export in the definition.

@JohnPucciarelli
Copy link

JohnPucciarelli commented Jul 6, 2017

Running into the same issue with the example given in the flow docs:
https://flow.org/en/docs/libdefs/creation/

declare module "some-es-module" {
  // Declares a named "concatPath" export
  declare export function concatPath(dirA: string, dirB: string): string;
}

ESLint: Parsing error: Unexpected token

@njgraf512
Copy link

Similar issue with a fileName.js.flow file

/* @flow */
declare export function camelCaseKeys<T> (obj: T): T;
declare export function snakeCaseKeys<T> (obj: T): T;

Algo getting Parsing error: Unexpected token

Suggestions?

@andela-cofor
Copy link

Make sure your are doing this import type { Match } from "react-router-dom";

@cubodehelio
Copy link

Similar issue here:

declare module "foo-module" {
  declare export type Foo = {
    bar: string
  };
}
[eslint]
Parsing error: Unexpected token

  1 | declare module "foo-module" {
> 2 |   declare export type Foo = {
    |                  ^
  3 |     bar: string
  4 |   };
  5 | }```

@gajus
Copy link
Owner

gajus commented May 18, 2020

Closing as stale.

@gajus gajus closed this as completed May 18, 2020
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

6 participants