Having trouble understanding why the command
tsc *.ts
isn't functioning correctly. The error message TS6053: File '*.ts' not found keeps appearing. Any suggestions on how to compile all the .ts files within a directory? Thank you!
Having trouble understanding why the command
tsc *.ts
isn't functioning correctly. The error message TS6053: File '*.ts' not found keeps appearing. Any suggestions on how to compile all the .ts files within a directory? Thank you!
When executing the tsc
command in the terminal without having a tsconfig file available, remember to provide it with a specific file name, such as app.ts
- the command will handle the dependencies for you, eliminating the need for wildcards.
However, if you do have a tsconfig.json file, simply run the tsc
command without specifying a file name argument and it will utilize the configuration settings, which may include the use of wildcards.
If you simply enter "tsc" in the terminal, it will automatically compile all of your TypeScript (.ts) files into JavaScript (.js) files. To bundle them together, you can use the command "tsc --outFile mybundle.js".
It's important to clarify that by bundling, it means consolidating all your JavaScript code into a single file. For more advanced configurations, consider setting up a tsconfig.json file as suggested by others.
Today, I ran into an issue while trying to execute 2 files in a folder that I created a few months ago when I first started learning Angular. Interestingly, I did not encounter this problem back then.
Important to note: The file had remained untouched since the initial modification and executed successfully at that time.
Although not the most ideal solution, the following workaround worked for me today.
Situation: In a folder containing "LikesComponent.ts" and "main.ts" files, I needed to execute both TS files to obtain the output. So I ran
tsc *.ts && node main.js
An error popped up:
error TS6053: File '*.ts' not found.
Found 1 error.
However, running the command below resolved the issue:
tsc LikesComponent.ts main.ts && node main.js
Dealing with a similar issue myself, you might want to give this command a shot: tsc --outFile file.js file.ts
It appears that the solution marked as correct may not be the best approach, especially if you are new to Angular and following tutorials by Mosh.
The alternative solution would be to simply execute the root file where all other modules are imported. In my case, this file is main.ts, and below is the command I used to run it:
$tsc main.ts && node main.js
If you're operating on a linux system, try this out:
find . -name "*.ts" | xargs tsc
The xargs utility will transform the results of the find command into arguments for the tsc compiler.
Keep in mind that this approach also covers subdirectories:
find src/ -name "*.ts" | xargs tsc
I have been receiving JSON files in the following format: {streetAddress: "Kosterlijand 20", postalCode: "3980", city: "Bunnik", country: "Netherlands"} Although the length of these files varies, the structure always remains the same: {key: "string valu ...
Having some trouble setting up a web app with TypeScript and jspm & system.js for module loading. Progress is slow. After installing jspm and adding jQuery: jspm install jquery And the initial setup: <script src="jspm_packages/system.js"></scri ...
I am currently tasked with implementing a value transformation process that involves multiple steps. To ensure reusability of these steps, a proposed architecture allows for passing steps to the transformation function. For example, transforming a long str ...
Everything was running smoothly in Angular16. I had "@types/openui5" : "1.40.4" listed in my dev-dependencies. Here is how it's configured in the tsconfig.json: { "compilerOptions": { "downlevelIteration": ...
Is there a way to ensure that the mat-slide-toggle remains true under certain conditions? I am looking for a functionality similar to forcedTrue="someCondition". <mat-slide-toggle formControlName="compression" class="m ...
Several routes have been defined in the following manner: export const AppRoutes: Routes = [ {path: '', component: HomeComponent, data: {titleKey: 'homeTitle'}}, {path: 'signup', component: SignupComponent, data: {titleKe ...
Here is a simplified version of my project requirements: abstract class Parent { protected abstract method(): any; } class Child extends Parent { protected method(): any {} protected other() { let a: Parent = new Child() a.me ...
While going through an Angular dynamic forms tutorial, I came across this code snippet and got confused by the {} = {} in the constructor. Here is the complete snippet: export class QuestionBase<T> { value: T; key: string; label: string; re ...
My current component is designed to display two different datasets, each with their own unique nature of data: state.articleTypeList: string[] state.renderPriceClassNameList: {[key: string]: string[]} To render both datasets within a single v-for componen ...
I am encountering an issue with using external imports of jQuery in webpack. Despite trying different import syntaxes such as import $ from 'jquery', import * as $ from 'jquery, and const $ = require('jquery'), I continue to receiv ...
My website needs to integrate Mailchimp's API in order for users to subscribe to a newsletter by entering their email into a field. I am looking to implement this without relying on any external libraries. To test out the functionality, I have set up ...
Within the code below, there is a nested subscribe function. It takes a schedule_id and retrieves questions based on that schedule_id. The functionality works correctly, but the order in which getQuestion() is executed is not guaranteed. Schedule IDs: 111, ...
I created a set of icons based on a github help page like this: const tableIcons = { Add: forwardRef((props, ref) => <AddBox {...props} ref={ref} />), DetailPanel: forwardRef((props, ref) => ( <ChevronRight {...props} ref={ref} /> ...
My angular app contains the mat-slide-toggle functionality. switchValue: {{ switch }} <br /> <mat-slide-toggle [checked]="switch" (toggleChange)="toggle()">Toggle me!</mat-slide-toggle> </div> This is how the ...
I am currently utilizing graphCMS in combination with NextJS and have successfully implemented fetching data. However, I am facing an issue where I need to execute 2 queries on the homepage of my website - one for all posts and another for recent posts. q ...
In my current scenario, I am faced with the following issue : module SomeName { class SomeName { } var namespace = SomeName; } The problem is that when referencing SomeName, it is pointing to the class instead of the module. I have a requireme ...
This is the code snippet from item.ts file:- export interface item{ $key?:string; available?:boolean; countable?:boolean; iname?:string; price?:string; desc?:string; image?:string; } The items component item.componenet.ts looks like this:- import { Com ...
I recently upgraded my Angular 7 code to Angular 9 by following the steps outlined in the Angular Upgrade guide. However, upon completion of the migration process, I started encountering numerous "Cannot find name" errors within the HTML templates of my co ...
Looking to split a string into an array based on type, extracting numbers and floats. The current code is able to extract some values but not complete. var arr = "this is a string 5.86 x10‘9/l 1.90 7.00" .match(/\d+\.\d+|\d+&bsol ...
Here is a function I am working with: const [dataLoc, setDataLoc] = useState({date: "No data received yet from sensor", coords: {}}); This is where I set the location: Geolocation.getCurrentPosition( location => { const date = d ...