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

Doesn't seem to support TypeScript #103

Open
codthing opened this issue Jan 17, 2021 · 2 comments
Open

Doesn't seem to support TypeScript #103

codthing opened this issue Jan 17, 2021 · 2 comments

Comments

@codthing
Copy link

codthing commented Jan 17, 2021

expo install react-native-static-server

image

Prompt that the module cannot be found

image

image

image

Version:
win10
"expo": "~40.0.0"
"react": "16.13.1"
"react-dom": "16.13.1"
"react-native": "https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz"
"react-native-static-server": "^0.5.0"

@codthing codthing changed the title Doesn't seem to support Expo and TypeScript Doesn't seem to support TypeScript Jan 18, 2021
@zholmes1
Copy link

declare module 'react-native-static-server' {
  export default class StaticServer {
    constructor(port: number, path?: string)
    start: () => Promise<string>
    stop: () => void
    isRunning: () => Promise<boolean>
  }
}

Here's what I'm using. I didn't send a PR because it seems the constructor parameters are a little wonky. So I just typed for the constructor for how I use it. Put this in index.d.ts at the root of your project and you should be good to go.

@smellman
Copy link
Contributor

I added typescript supports after 0.5.0 release.
My PR was merged at last year but @fchasen didn't release it.

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

3 participants