Skip to content

Commit 4311070

Browse files
fix: builing of nativescript-cloud package fails
Building the nativescript-cloud package fails with error: ``` node_modules/nativescript/lib/services/analytics/analytics.d.ts(67,9): error TS2304: Cannot find name 'AnalyticsLoggingMessageType'. ``` The problem is that the build of `nativescript-cloud` extension needs to get all interfaces from CLI and include them in the global scope of the `nativescript-cloud`, so it can be transpiled. Currently this is done by iterrating over all files in nativescript and searching for `.d.ts` files. For each `.d.ts` file, we create a new entry in a `references.d.ts` file in the root of `nativescript-cloud`. When trying to transpile the project, it fails as one of the included references (`analytics.d.ts`) uses a type (enum in this case) that is not available in the included references. Fix this by moving the enums to `.d.ts` files - this way the transpiled `.js` files will not change (TypeScript strips all const enums from produced `.js` by replacing the enum usage with the actual value) and the transpilation of `nativescript-cloud` will work as well.
1 parent e2b55b2 commit 4311070

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/services/analytics/analytics-constants.ts renamed to lib/services/analytics/analytics-constants.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Defines messages used in communication between CLI's process and analytics subprocesses.
33
*/
4-
const enum AnalyticsMessages {
4+
declare const enum AnalyticsMessages {
55
/**
66
* Analytics Broker is initialized and is ready to receive information for tracking.
77
*/
@@ -11,7 +11,7 @@ const enum AnalyticsMessages {
1111
/**
1212
* Defines the type of the messages that should be written in the local analyitcs log file (in case such is specified).
1313
*/
14-
const enum AnalyticsLoggingMessageType {
14+
declare const enum AnalyticsLoggingMessageType {
1515
/**
1616
* Information message. This is the default value in case type is not specified.
1717
*/

0 commit comments

Comments
 (0)