Seeking a solution: How can I get Sublime Text 3 to automatically compile Typescript code when I save it? Having to switch between the terminal and Sublime is getting tedious. Appreciate any advice, thank you!
Seeking a solution: How can I get Sublime Text 3 to automatically compile Typescript code when I save it? Having to switch between the terminal and Sublime is getting tedious. Appreciate any advice, thank you!
Unsure how to save it on command, but you can achieve it by pressing ctrl+b. To make this method functional:
Copy and paste the code below:
{
"cmd": ["tsc","$file"],
"file_regex": "(.*\\.ts?)\\s\\(([0-9]+)\\,([0-9]+)\\)\\:\\s(...*?)$",
"selector": "source.ts",
"windows": {
"cmd": ["tsc.cmd", "$file"]
}
}
Save it as "myTypeScript.sublime-build"
Go to Tools->Build System and select the created build system "myTypeScript.sublime-build"
To compile, simply press ctrl+b
You can find further explanation and guidance here
To compile your .TS files, open a terminal window in the folder where they are located and run 'tsc -w' to monitor changes and automatically compile them into .js files. Make sure you have the latest version of TypeScript installed for Node.js. Keep the terminal window open until you're done working. There's no need for any "compile on save" feature as it's not always reliable. Additionally, the TypeScript package in Sublime Text 3 is outdated.
Appreciate the help! Initially, I thought the solution was only for a single file. However, realizing I had multiple scripts in the folder, I sought out an alternative on the internet. Just in case someone else encounters this issue:
{
"compilerOptions": {
"emitDecoratorMetadata": false,
"module": "commonjs",
"target": "ES5"
},
"files":["your_script_0.ts", "your_script_1.ts"],
"exclude": [
"node_modules"
]
}
To proceed, navigate to the source folder in the terminal (in my situation, it's /js) and utilize these commands:
tsc -p .
tsc -w
Feel free to point out any mistakes or improvements regarding the command usage. Nonetheless, this approach has proven effective for me.
Attention all sublime text enthusiasts!
ctrl+shift+p
, then type "install package" and hit enter.Sublimeonsavebuild
and press enter.preferences > package settings > Sublimeonsavebuild > setting - user
, paste in the code provided below, and save.{ "filename_filter": "(/|\\\\|^)(?!_)(\\w+)\\.(ts|sass|less|scss)$", "build_on_save": 1 }
tools > build system > new build system
, paste in the following code, save it as "Typescript", and select this build option.{ "cmd": ["tsc","$file"], "file_regex": "(.*\\.ts?)\\s\\(([0-9]+)\\,([0-9]+)\\)\\:\\s(...*?)$", "selector": "source.ts", "windows": { "cmd": ["tsc.cmd", "$file"] } }
If I have tuples similar to this for keys and values: type Keys = ['North', 'East', 'South', 'West']; type Values = ['n', 'e', 's', 'w']; Is there a way to achieve a structure ...
I am working with Mongoose and creating a view on a collection. NewSchema.createCollection({ viewOn: originalModel.collection.collectionName, pipeline: [ { $project: keep.reduce((a, v) => ({ ...a, [v]: 1 }), {}), }, ], ...
I am in search of a type that can describe any path through an object starting from the top (root) properties all the way down to every leaf property in the form of a string array. The following are the key characteristics required: The object's stru ...
I'm currently working on implementing a feature to export data as xlsx files. I have been successful in exporting CSV and PDF formats, but encountered issues with the xlsx format due to dynamic imports. export const exportToXlsx = async ( gridElemen ...
I'm working on an Angular v6 app where I need to display a drop-down and make it required based on a boolean value that is set by a checkbox. Here's a snippet of the template code (initially, includeModelVersion is set to false): <mat-checkbo ...
axis: { x: { type: "category" } }, An issue has arisen: The different types of 'axis.x.type' are not compatible with each other. The value of 'string' cannot be assigned to '"category" | &qu ...
Having an issue with utilizing the Cascader component from AntDesign and managing its values upon change. The error arises when attempting to assign an onChange function to the onChange property of the component. Referencing the code snippet extracted dire ...
My micro-frontend angular project is using mfe (module federation). I recently updated it from angular 13 to 14 and encountered some warnings such as: node_modules\ngx-translate-multi-http-loader\dist\multi-http-loader.js depends on ' ...
Currently, I am in the process of developing an ecommerce platform using the MERN stack combined with TypeScript. As part of this project, I am working on a feature that allows users to provide reviews for products. The goal is to limit each user to only o ...
I'm facing an issue with a NaN error in my TypeScript code. I've defined a variable type as number and loop through an element to retrieve various balance amounts. These values are in the form of "$..." such as $10.00 and $20.00, so I use a repla ...
<ion-list> <ion-item-group *ngFor="let group of groupedContacts"> <ion-item-divider color="light">{{group.letter}}</ion-item-divider> <ion-item *ngFor="let contact of group.contacts" class="contactlist" style="cl ...
I'm currently utilizing <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b0ded5c8c49dd1c5c4d8f0849e81889e87">[email protected]</a> & <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemai ...
Hey there, I'm looking for a way to pass a single property (groupId) from a parent component to a child component. In this case, my child component is using ngx-bootstrap modal. Is there a solution available for this scenario? Essentially, I need to i ...
I am currently working on an Angular project where one of the links needs to redirect to a different website. During development, this link points to a localhost URL like localhost:4210. However, due to security reasons in Angular, using such URLs is cons ...
Here is my latest middleware implementation: export async function middleware(request: NextRequest) { const token = request.headers.get('token') console.log(token) if (!token || token == undefined) { return NextResponse.redirect(new URL('/lo ...
Working on integrating the "in-app-browser" plugin with my Ionic project. Check out the code snippet below: const browser = this.iab.create(mylink, '_blank'); browser.on('loadstop').subscribe( data => { if ...
I am a novice when it comes to tslint and typescript. Attempting to resolve the error: Unnecessary local variable - stackThird. Can someone guide me on how to rectify this issue? Despite research, I have not been successful in finding a solution. The err ...
I'm currently facing an issue with the Primeng Turbotable where I am unable to expand all rows by default. You can find a code example of my problem at this link. I have already tried implementing the solution provided in this example, but unfortuna ...
When I have a form with veevalidate and submit it, the data is emitted to the parent component, but I struggle with resetting the form. According to the veevalidate guidelines, the form should be reset using $refs. To set up the refs, follow this link: T ...
I am currently working with Angular 16 and AgGrid 30. My goal is to have the cell editor created in a different location than its default position, which is within a div element at the bottom of the body with these classes: ag-theme-material ag-popup. I w ...