Is it possible to import a class from a different project or module in TypeScript?

I am attempting to modify the build task in Typescript within this specific project: https://github.com/Microsoft/app-store-vsts-extension/blob/master/Tasks/app-store-promote/app-store-promote.ts

I am looking to incorporate an import similar to the one below (or any other method that allows me to utilize the methods in the ios-signing-common module):

import sign = require('ios-signing-common/ios-signing-common');

This import is used in another file from a different project: https://github.com/Microsoft/vsts-tasks/blob/master/Tasks/XamariniOS/xamarinios.ts, however, that project also contains the ios-signing-common. https://github.com/Microsoft/vsts-tasks/blob/master/Tasks/Common/ios-signing-common/ios-signing-common.ts

Is it feasible to import the ios-signing-common module into the app-store-promote file?

I have attempted adding the github path "Microsoft/vsts-tasks" as a dependency in package.json, and it downloads into node_modules, but I still can't resolve the ios-signing-common module.

Any guidance towards finding a solution would be greatly appreciated. :)

Answer №1

After some research, I realized I needed to delve deeper into understanding module resolution.

To resolve the issue, I included vsts-tasks as a dependency in my package.json file:

"dependencies": {
    "vsts-task-lib": "^0.9.7",
    "vsts-tasks": "Microsoft/vsts-tasks"
  },

Next, I updated the require path like so:

import sign = require('Agent.Tasks/Tasks/Common/ios-signing-common/ios-signing-common');

And voila! It's now functioning properly!

UPDATE - Although it was able to compile, when executed, the script encountered an error because it couldn't locate

Agent.Tasks/Tasks/Common/ios-signing-common/ios-signing-common
.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

When attempting to open a link in a new tab, the ng-click function fails to execute

In Angular, utilizing both the <code>ng-click and ng-href directives at the same time will result in the click function being executed first. In this scenario, clicking on a link that navigates to Google will be prevented and instead an alert will be ...

What can I do to stop a webpage from automatically refreshing when I submit a form?

I'm currently in the process of building my very first website, and I've run into a bit of a snag that I can't seem to figure out. Whenever a user tries to add an item to the cart or increase the quantity, I want to avoid the page refreshing ...

How can you apply filtering to a table using jQuery or AngularJS?

I am looking to implement a filtering system for my table. The table structure is as follows: name | date | agencyID test 2016-03-17 91282774 test 2016-03-18 27496321 My goal is to have a dropdown menu containing all the &apo ...

Monitoring modifications in elements within an array using Angular2

Currently using Angular 2 and typescript, I have an array in which I am utilizing DoCheck and IterableDiffer to monitor any changes. While I receive notifications when the array itself is modified, I do not get notified if a property within one of the obje ...

Update a nested object key by concatenating key names with "." to create a string

Imagine having this specific object structure: var obj = { level1 :{ level2: { level3: { title: "champion" } } } } Now the goal is to update the title key using a provided string (note that it's a string, not an actua ...

JavaScript CompleteLink message

Hey there, I've come across a JavaScript code for a countdown timer but need some assistance with it. The issue I'm facing is that within the code, there's a line that displays a message to the user when the timer reaches zero. I want to kn ...

Several directories for viewing in Node.js with Express

I have been researching different solutions, but I am still unsure about how to effectively integrate Express with multiple view folders. Imagine an Express application divided into distinct parts, each organized in its own subfolder: app +partA + ...

Using a prop array as v-model in a Vue JS CheckBoxGroup implementation

Struggling to create a reusable CheckBoxGroup component with a prop array as v-model. I checked out the vuejs guide at https://v2.vuejs.org/v2/guide/forms.html#Checkbox which uses the v-model array in the data of the same component. However, this approach ...

What is the best way to save the value returned by a foreach loop into an array and then send two responses

After attempting to store the doctor details in an array and display the appointment and doctor Name Value response, I encountered a problem. The Appointment value is successfully achieved, but the doctor Name Value appears empty even though it shows in th ...

What is the most effective method to install an npm package on an offline computer, guaranteeing the inclusion of

My current situation requires me to work on a computer network with no internet access. I'm interested in using jsbin for SharePoint/Windows development, as it is highly recommended for its npm installation that ensures all necessary dependencies are ...

Is there a way to pre-load the data prior to the component rendering in ReactJS?

The main goal of my project is to retrieve data from the Google Analytics API and display it as a list. Although I am able to successfully fetch the data from the API, I am encountering an issue when passing it to another component. While I can view the da ...

Modifying the display toggle functions

How can I toggle between a button and an input type "file" when clicked? I am using jQuery to show and hide elements, but I need help changing back to the button when clicking somewhere else on the page. HTML: Upload<input type="button" id="upload" /& ...

What is the best way to redirect users to the login page when they are logged out from a different tab or window?

Ensuring user authentication and managing inactivity are crucial components of my Nodejs application, where I leverage cookie-session and passport.js. app.use(require("cookie-session")({ secret:keys.session.secret, resave:false, saveUninitiali ...

Adjust Vue FilePond dimensions

I am currently working with a Vue Filepond and trying to ensure that it fills the height of its container. My Vue Filepond setup also involves Vuetify. Whenever I attempt to set values in the CSS, they are constantly overridden by 76px. Although fill-hei ...

I am puzzled as to why my function's return type transforms into a promise when I interact with the cell.value or use console.log

Recently, I embarked on the journey of coding a validation process for my Excel Sheet. To keep the code concise, I implemented it in a straightforward manner. Here is a snippet of my source code: function main(workbook: ExcelScript.Workbook) { console. ...

Tips for showing solely the current page number within angular pagination

HTML : <!-- pagination controls --> <div class="pagination-container"> <pagination-controls (pageChange)="onPageChange($event)" [maxSize]="1" [id]="config.id" [directionLinks]="true">< ...

methods for performing multiplication on dynamically inserted variables using jquery

I'm trying to dynamically calculate the total amount based on the price and product quantity after changing the value in the #quantity text-box. I implemented the following solution, but upon checking the Firefox console, I noticed that there is no ca ...

Error message: Conflicting type declarations across multiple files

I am facing a challenge with my TypeScript 'snippets' project. It seems that multiple .ts files contain type names (like Foo) that are the same. //file-a.ts type Foo = { } //file-b.ts type Foo = { } When attempting to compile, I encounter ...

Using Twig path to pass Ajax URL parameter

I'm facing an issue in my Twig view when passing parameters in the AJAX URL path. Since Twig is executed before JavaScript, it doesn't recognize the input value passed as a parameter. Is there a way to solve this without passing the param in data ...

An application running on Node.js/Express and hosted on Digital Ocean encounters the "Cannot get /" error message

Despite searching extensively online and sifting through numerous solutions to different scenarios, I remained unable to find a fix that resolved my issue. When attempting to run my server.js file locally, everything operates smoothly. However, upon transf ...