bebnev / react-native-user-agent

Library that helps you to get mobile application user agent and web view user agent strings
MIT License
42 stars 42 forks source link

Add TypeScript definitions #21

Closed flut1 closed 2 years ago

flut1 commented 4 years ago

I typed properties that only exist on iOS as possibly undefined. In case you're not familiar with TypeScript: this should be a relatively safe change, it does not affect runtime behavior.

Resolves #15

pke commented 4 years ago

You might want to wrap that as a TS module maybe?

flut1 commented 4 years ago

@pke Are you referring to declare module '...' { } ambient modules? If I understand correctly this is only used if you're declaring types for another module. As we're declaring types for react-native-user-agent and import "react-native-user-agent" in the TS compiler also resolves to our index.d.ts file, a module declaration is unnecessary here.

See this reference example from the TS docs, or for example the types from react-native-picker or react-native-config

pke commented 4 years ago

@bebnev care to merge this then, please?

bebnev commented 2 years ago

version 2.3.1