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

Missing type definitions

Open jrr opened this issue 4 years ago • 3 comments

This project doesn't have type definitions, which would help TypeScript users. I'll try to contribute some when I get a chance.

jrr avatar Aug 13 '19 16:08 jrr

First incomplete draft for types:

declare module 'react-native-static-server' {
  type Options = {
    localOnly?: boolean
    keepAlive?: boolean
  }

  export default class StaticServer {
    constructor(port: number, root?: string, opts?: Options)

    port: number
    root: string
    localOnly: boolean
    keepAlive: boolean
    started: boolean
    _origin?: string

    start: () => Promise<string>
    stop: () => Promise<any>
    isRunning: () => Promise<boolean>
    kill: () => void
  }
}

vmarquet avatar Oct 29 '19 23:10 vmarquet

Any update on this?

rmathias86 avatar Mar 02 '20 04:03 rmathias86

I'm not working with React Native any more, but for anyone who's interested in contributing: instead of maintaining a separate definitions file, it might be easier to port https://github.com/futurepress/react-native-static-server/blob/master/index.js to TypeScript.

jrr avatar Mar 02 '20 05:03 jrr