From fd9857d6b54a1eebddbb760b282beeebe259bbd1 Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Thu, 15 Sep 2022 19:16:37 +0200 Subject: [PATCH] Use polymorphic variant for Platform.os --- src/apis/Platform.res | 16 +--------------- src/apis/Platform.resi | 15 --------------- 2 files changed, 1 insertion(+), 30 deletions(-) delete mode 100644 src/apis/Platform.resi diff --git a/src/apis/Platform.res b/src/apis/Platform.res index 45dae141..bd56a5d3 100644 --- a/src/apis/Platform.res +++ b/src/apis/Platform.res @@ -1,15 +1 @@ -type os = string - -@module("react-native") @scope("Platform") external os: os = "OS" - -@inline -let ios = "ios" - -@inline -let android = "android" - -// react-native-web -@inline -let web = "web" - -external unsafe: string => os = "%identity" +type os = [#ios | #android | #macos | #windows | #web] diff --git a/src/apis/Platform.resi b/src/apis/Platform.resi deleted file mode 100644 index f75a537b..00000000 --- a/src/apis/Platform.resi +++ /dev/null @@ -1,15 +0,0 @@ -type os = private string - -@module("react-native") @scope("Platform") external os: os = "OS" - -@inline("ios") -let ios: os - -@inline("android") -let android: os - -// react-native-web -@inline("web") -let web: os - -external unsafe: string => os = "%identity"