th3rdwave / react-native-safe-area-context

A flexible way to handle safe area insets in JS. Also works on Android and Web!
MIT License
2.09k stars 191 forks source link

Desktop specific (.windows, .macos) file suffixes have incorrect typings #402

Closed magom001 closed 1 year ago

magom001 commented 1 year ago

version 4.6.0

Issues #1: In the package json you have "types": "lib/typescript/index.d.ts",, but there is no index.d.ts there, it should be "types": "lib/typescript/src/index.d.ts",

Issue #2:

  1. Create a tsconfig.json file with "moduleSuffixes": [".windows", ".electron", ".web", ""],
  2. Try to write something like <SafeAreaView ... edges={['top', 'left']}>...

Expected result: everything compiles Actual result: TS error "Property 'edges' does not exist"...

By navigating to the SafeAreaView definition for windows we see:

import { View } from 'react-native';

export const SafeAreaView = View;

For obvious reasons View does not have edges property.

jacobp100 commented 1 year ago

400

magom001 commented 1 year ago

@jacobp100 the #400 only fixes the issue #1

jacobp100 commented 1 year ago

Could you do a PR?

magom001 commented 1 year ago

@jacobp100 I'll look into it

magom001 commented 1 year ago

@jacobp100 please see the pr: https://github.com/th3rdwave/react-native-safe-area-context/pull/404

I figured that since it is for type definitions only, just a cast will do

magom001 commented 1 year ago
Screenshot 2023-06-21 at 15 53 59

generated type definitions after changes