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

[fix] Incorrect global declaration #813

Merged
merged 1 commit into from
Sep 13, 2022
Merged

[fix] Incorrect global declaration #813

merged 1 commit into from
Sep 13, 2022

Conversation

nan-li
Copy link
Contributor

@nan-li nan-li commented Aug 26, 2022

Description

One Line Summary

Fix previous incorrect workaround for a TypeScript compiler error.

Details

Motivation

To remedy reported issue #809.

  • Background: Typescript gives errors because cordova is not part of the window object when we call for example window.cordova.exec()
  • The error given is like: "Property 'cordova' does not exist on type 'Window & typeof globalThis'."
  • The previous workaround of declaring globally the cordova and plugins property on Window to be of type any is incorrect, as this affects end users who may have a type for Cordova, etc.

Scope

Affects TypeScript compiler and type checking only.

Testing

Unit testing

No unit testing

Manual testing

  1. Confirmed the reported incorrect behavior in an example app.
  2. Check that this PR addresses the incorrect behavior in an example app.

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

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

This change is Reviewable

@nan-li nan-li requested review from rgomezp and emawby August 26, 2022 15:06
*  Typescript gives errors because cordova is not part of the window object when we call for example `window.cordova.exec()`
* The error given is like: "Property 'cordova' does not exist on type 'Window & typeof globalThis'."
* The workaround of declaring globally the cordova and plugins property on Window to be of type any is incorrect.
* This affects end users who may have a type for Cordova, etc.
@nan-li nan-li merged commit fb97068 into main Sep 13, 2022
@nan-li nan-li deleted the fix_bad_global_types branch September 13, 2022 22:20
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