futurepress / react-native-static-server

HTTP static file server for React Native
MIT License
360 stars 183 forks source link

Missing type definitions #67

Open jrr opened 5 years ago

jrr commented 5 years ago

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

vmarquet commented 4 years ago

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
  }
}
rmathias86 commented 4 years ago

Any update on this?

jrr commented 4 years ago

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.