Skip to content

Conversation

alanblins
Copy link
Contributor

@alanblins alanblins commented May 14, 2024

Fix typescript declaration files on packages
Fix typescript issues of sample app AEPSampeApp

Description

Fix typescript declaration files on packages

Fixed fields main and add types fields to package.json files of packages/*, example:

file: packages/campaignclassic/package.json
current

{
  "name": "@adobe/react-native-aepcampaignclassic",
  "version": "6.0.1",
  "description": "Experience Platform Campaign Classic extension for Adobe Experience Platform Mobile SDK. Written and Supported by Adobe.",
  "homepage": "https://developer.adobe.com/client-sdks/documentation/",
  "license": "Apache-2.0",
  "main": "./ts/index.ts",
  "scripts": {
    "cleanup": "rm -rf node_modules",
    "tsc": "tsc"
  },

fixed

{
  "name": "@adobe/react-native-aepcampaignclassic",
  "version": "6.0.1",
  "description": "Experience Platform Campaign Classic extension for Adobe Experience Platform Mobile SDK. Written and Supported by Adobe.",
  "homepage": "https://developer.adobe.com/client-sdks/documentation/",
  "license": "Apache-2.0",
  "main": "./js/index.js",
  "types": "./js/index.d.ts",
  "scripts": {
    "cleanup": "rm -rf node_modules",
    "tsc": "tsc"
  },

Fix typescript issues of sample app AEPSampeApp

  • Removed null values
  • Added back the types/props.ts

Related Issue

It fixes the issue 353.

How to reproduce

Clone the repo adobe/aepsdk-react-native and compile the typescript of apps/AEPSampleApp;

git clone https://github.com/adobe/aepsdk-react-native
cd aepsdk-react-native
npm i
cd aepsdk-react-native/apps/AEPSampleApp
npx tsc

Motivation and Context

This is causing issues for consumers that has the option strictNullChecks:true on their tsconfig when they update to the version 6.0.0 described on the issue 353. This is blocking the consumers to upgrade the library or forcing them to change their tsconfig.

The root cause is that the package.json files from all the packages, contain the typescript file itself on main field, rather than javascript and declaration files as described on typescript documentation.
current

"main": "./ts/index.ts"

changed

"main": "./js/index.js"
"types": "./js/index.d.ts"

The bug is also in the sample app of the aepsdk-react-native repo itself when running the command npx tsc at aepsdk-react-native/apps/AEPSampleApp.

How Has This Been Tested?

The changes were tested by:

  • running the unit tests available: npm run test
  • running npx tsc command at aepsdk-react-native/apps/AEPSampleApp

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@alanblins alanblins mentioned this pull request May 14, 2024
3 tasks
@alanblins alanblins force-pushed the fixTypescriptTypes branch from aa7ceed to 1bf79e8 Compare May 14, 2024 18:49
@yangyansong-adbe yangyansong-adbe changed the base branch from dev to feature/fix_353 May 17, 2024 20:42
@yangyansong-adbe yangyansong-adbe self-requested a review May 17, 2024 20:43
@yangyansong-adbe
Copy link
Contributor

@alanblins Thank you for the pull request. We will merge the code changes into a feature branch as we still have some cleanup to do before releasing all packages.

@yangyansong-adbe yangyansong-adbe merged commit 2868ae6 into adobe:feature/fix_353 May 17, 2024
yangyansong-adbe added a commit that referenced this pull request Jun 6, 2024
)

* fix typescript errors (#354)

* Enable strictNullChecks (#358)

* project cleanup (#359)

---------

Co-authored-by: Alan Lins <alanblins@gmail.com>
yangyansong-adbe added a commit that referenced this pull request Jun 6, 2024
* Enable strictNullChecks for the package projects + project cleanup (#360)

* fix typescript errors (#354)

* Enable strictNullChecks (#358)

* project cleanup (#359)

---------

Co-authored-by: Alan Lins <alanblins@gmail.com>

* version bump up (#362)

* add a npmignore file to the root directory (#363)

---------

Co-authored-by: Alan Lins <alanblins@gmail.com>
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