react-native-static-server icon indicating copy to clipboard operation
react-native-static-server copied to clipboard

Doesn't seem to support TypeScript

Open codthing opened this issue 5 years ago • 2 comments

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 avatar Jan 17 '21 12:01 codthing

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.

zholmes1 avatar Jan 19 '21 22:01 zholmes1

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

smellman avatar Apr 11 '21 23:04 smellman