Skip to content

Conversation

@ChromeQ
Copy link

@ChromeQ ChromeQ commented Jan 29, 2025

Description

One Line Summary

Add declaration files so I can import types for plugin config

Details

Motivation

Currently I do something like this:

import {
  OneSignalPluginProps as ExpoOneSignalPluginConfig,
  Mode as ExpoOneSignalPluginMode,
} from '@chromeq/onesignal-expo-plugin/build/types/types'; // 👈️ Note `chromeq` is my fork of this repo to let this happen

// The only way currently it can work now is with the following: But Enum for mode won't work and isn't type safe as it comes in an `any` 😢
// import withOneSignalPlugin from 'onesignal-expo-plugin/build/onesignal/withOneSignal';
// type ExpoOneSignalPluginConfig = Parameters<typeof withOneSignalPlugin>[1];

// config 👇️
[
        'onesignal-expo-plugin',
        {
          mode:
            process.env.APP_PROFILE === 'production'
              ? ExpoOneSignalPluginMode.Prod
              : ExpoOneSignalPluginMode.Dev,
        } satisfies ExpoOneSignalPluginConfig, // 👈️ This is now type safe object and I get intellisense
      ],

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing

Testing

  • I have personally tested this on my device, or explained why that is not possible
  • I have tested this on the latest version of the plugin
  • I have tested this on both Android and iOS, or explained why that is not possible

Final pass

  • Code is as readable as possible.comments to the code.
  • I have reviewed this PR myself, ensuring it meets each checklist item

@ChromeQ
Copy link
Author

ChromeQ commented Feb 17, 2025

@rgomezp Sorry to ping but hopefully you can find some time to merge some small low risk ready to go PR's like this one. Cheers

@ChromeQ
Copy link
Author

ChromeQ commented Sep 9, 2025

@fadi-george I see you were the most recent committer so I wondered if you could review this literally one boolean change to help get type safety in config files? Thanks

@fadi-george
Copy link
Contributor

Hello,
I'll see who is available to take a look.

@nan-li nan-li self-requested a review September 9, 2025 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants