Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add declaration files to build output #241

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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

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.

1 participant