morenoh149 / react-native-contacts

React Native Contacts
MIT License
1.64k stars 560 forks source link

Android TypeScript definition incorrect #629

Closed mleonardallen closed 3 years ago

mleonardallen commented 3 years ago

For Android, company can be string | null, but the type definition just has string. If we assume it exists as the type definition states, we can cause an app crash. For example:

null is not an object (evaluating 't.company.substring')

export interface Contact {
    recordID: string;
    backTitle: string;
    company: string;
    emailAddresses: EmailAddress[];
    displayName: string;
    familyName: string;
    givenName: string;
    middleName: string;
    jobTitle: string;
    phoneNumbers: PhoneNumber[];
    hasThumbnail: boolean;
    thumbnailPath: string;
    postalAddresses: PostalAddress[];
    prefix: string;
    suffix: string;
    department: string;
    birthday: Birthday;
    imAddresses: InstantMessageAddress[]
    note: string;
}
morenoh149 commented 3 years ago

@mateosilguero nice. please patch the definitions https://github.com/morenoh149/react-native-contacts/blob/master/index.d.ts