1599318851
I wrote the first commit back in 2012 (think of jQuery and Bootstrap v1). It was also around the time I was moving to Tokyo for graduate school and before I started working as a professional software developer. Since then, there have been a lot of changes in both JavaScript (ES6, TypeScript, React, …) and my programming experience. This summer, I finally have time to stay home and work on redesigning the library.
Chrono, v2, is the project’s rewrite almost from scratch in TypeScript with the following goals in mind.
Chrono does only one thing — parsing date from the text. Thus, it should be as easy and straight-forward for people who want to use it for that. While hiding a deep layer of parsing complexity underneath, Chrono has always maintained minimal interface namely its parse()
function.
Aside from a few important differences (most importantly locales handling), Chrono v2 has the same minimalist APIs.
import * as chrono from ‘chrono-node’;
chrono.parseDate(‘Today at 5 PM’) // Return a javascript Date object
chrono.parse(’Today at 5 PM’) // Return more detailed results
You can customize Chrono by cloning the base setup and add/remove parsers
or refiners
:
import * as chrono from ‘chrono-node’;
const customChrono = new chrono.Chrono();
// or const customChrono = chrono.en.clone();
customChrono.parsers.push(...)
If you have been using Chrono, the change should be straightforward. If you are not, it should not be difficult to get started.
At the same time, for TypeScript projects, you get the free advantages for Chrono’s newly refined type system.
#typescript #datetime #javascript #web-development #programming
1601549700
Today I am going to talk about new features in Typescript 4.0.
TypeScript 4.0 comes with lots of new features to make JavaScript development easier.
You can label tuple elements.
You can write:
type Range = [start: number, end: number];
to restrict args
to have a string and a number.
you can also write:
type Foo = [first: number, second?: string, ...rest: any[]];
to have rest entries in your tuple.
If your tuple has type Foo
, then the tuple starts with a number and a string.
Then the rest of the entries can be anything.
Labels don’t require you to name your variables differently when destructuring.
For example, if you have:
function foo(x: [first: string, second: number]) {
const [a, b] = x;
}
then you can name the destructured variables anything you want.
#software-development #typescript-with-react #typescript #typescript-4 #react native
1599318851
I wrote the first commit back in 2012 (think of jQuery and Bootstrap v1). It was also around the time I was moving to Tokyo for graduate school and before I started working as a professional software developer. Since then, there have been a lot of changes in both JavaScript (ES6, TypeScript, React, …) and my programming experience. This summer, I finally have time to stay home and work on redesigning the library.
Chrono, v2, is the project’s rewrite almost from scratch in TypeScript with the following goals in mind.
Chrono does only one thing — parsing date from the text. Thus, it should be as easy and straight-forward for people who want to use it for that. While hiding a deep layer of parsing complexity underneath, Chrono has always maintained minimal interface namely its parse()
function.
Aside from a few important differences (most importantly locales handling), Chrono v2 has the same minimalist APIs.
import * as chrono from ‘chrono-node’;
chrono.parseDate(‘Today at 5 PM’) // Return a javascript Date object
chrono.parse(’Today at 5 PM’) // Return more detailed results
You can customize Chrono by cloning the base setup and add/remove parsers
or refiners
:
import * as chrono from ‘chrono-node’;
const customChrono = new chrono.Chrono();
// or const customChrono = chrono.en.clone();
customChrono.parsers.push(...)
If you have been using Chrono, the change should be straightforward. If you are not, it should not be difficult to get started.
At the same time, for TypeScript projects, you get the free advantages for Chrono’s newly refined type system.
#typescript #datetime #javascript #web-development #programming
1592360819
TypeScript just released its second release for the year on May 12. It’s version 3.9, which is now the stable version. In this article, I’m going to point out some of the new and exciting features of TypeScript 3.9.
#typescript #typescript 3.9 #javascript
1599308024
icrosoft recently announced the availability of TypeScript version 4.0. The developers at the tech giant claimed that this version of the language represents the next generation of TypeScript with more expressivity, productivity as well as scalability.
Developed by the tech giant, TypeScript is an open-source programming language that is built on top of JavaScript by adding syntax for static type definitions. The types in this language provide a way to describe the shape of an object, providing better documentation as well as allowing TypeScript to validate that the code is working correctly.
According to the latest Stack Overflow Developers survey 2020, it secured the second position as the most loved language and 9th position among 25 programming languages as the most commonly used programming language by the developers. In one of our articles, we discussed how TypeScript weighs over other programming languages.
It is one of the fastest-growing programming languages among the developers. The motive behind this language is that while writing down the types of values and where they are used, developers can use TypeScript to type-check the code and let them know about mistakes before they run the code. TypeScript compiler can be used to strip away types from the code, leaving them with clean, readable JavaScript that runs anywhere.
In the present scenario, TypeScript is a core part of many developer’s JavaScript stack. The language adds optional types to JavaScript that support tools for large-scale JavaScript applications for any browser, for any host and on any operating systems.
The program manager of TypeScript, Daniel Rosenwasser, said in a blog post, “In our past two major versions, we looked back at some highlights that shined over the years. For TypeScript 4.0, we’re going to keep up that tradition.”
Based on the feedback by the developer’s community, TypeScript 4.0 includes many intuitive features that are focussed on boosting the performance of this language. Some of them are mentioned below-
According to Rosenwasser, previously, compiling a program after a previous compile with errors under incremental would result in extremely slow performance when using the –noEmitOnError flag. The reason is, none of the information from the last compilation would be cached in a .tsbuildinfo file based on the –noEmitOnError flag.
But now TypeScript 4.0 changes this. The new update provides a great speed boost in these scenarios, and in turn, improves the build mode scenarios, which imply both –incremental and –noEmitOnError.
#developers corner #microsoft #microsoft releases typescript 4.0 #programming language #programming language with high salary #typescript #typescript 4.0
1603953021
Maybe you’ve been using JavaScript for a while and you’ve been hearing the buzz around… TypeScript. In this 2 part series, we’ll take a look at Why TypeScript? and Why Not TypeScript?
According to the TypeScript website “TypeScript extends JavaScript by adding Types… TypeScript code is transformed into JavaScript code via the TypeScript compiler or Babel. This JavaScript is clean, simple code which runs anywhere JavaScript runs…”. In short, many refer to TypeScript as a superset of JavaScript.
In my opinion, this is kind of true and kind of not. Technically, not all valid JavaScript code can also be TypeScript code. We’ll talk about that later on. But, at its core, TypeScript was designed to allow developers to turn JavaScript, a dynamic programming language (one that is interpreted at runtime) into a statically typed programming language (one that is compiled before running). Let’s dive in.
TypeScript makes use of features similar to languages like C## or Java: it truly is object oriented. This allows for more robust code. It enables the developer to implement type checking and make use of interfaces, classes, inheritance, etc. This can up the game as far as clean code when looking at a JavaScript program and a TypeScript program.
_Why did you throw in the word _potentially? Well, most valid JavaScript code can become TypeScript code. This means you don’t have to use the object oriented or typed features of TypeScript. Remember, TypeScript is optionally typed. It is not required. If TypeScript is utilized merely like JavaScript then improved code quality may not actually be a thing.
#typescript #programming #javascript #web-development #developer