typescript2.1 Questions
6
Solved
Let's suppose I've a project, and its main source directory is:
C:\product\src
Based on this directory, every import path would be relative to it. I.e., suppose:
// Current script: C:\product\s...
Adjoint asked 8/2, 2017 at 20:53
2
Solved
I'm trying to cancel my async method call in Typescript.
To do this, I have created a new Promise type, which inherits from Promise:
class CancelablePromise<T> extends Promise<T>{
p...
Starobin asked 10/4, 2017 at 15:27
5
Solved
I can't find TypeScript definition @type/{name} for one of my installed NodeJS packages, so I attempt to write a d.ts file for it, and put the file in {project root}\typings folder. This is how I d...
Smaragdite asked 22/2, 2017 at 9:57
4
Solved
UPDATE 2021
For a working solution using newer features see this answer https://stackoverflow.com/a/59647842/1323504
I'm trying to write a function where I'd like to indicate that it returns some ...
Seep asked 3/2, 2017 at 15:39
3
Solved
TypeScript 2.1 Apparently now has support for writing custom html elements ("What's new in TypeScript - 2.1")
However I have been unable to find any documentation on how this is supposed to work.
...
Selfabuse asked 11/12, 2016 at 11:27
4
Solved
It would be great if we had type checking inside the SimpleChanges typescript parameter of ngOnChanges hook for the current Component.
This would prevent us from errors in the properties we check...
Fishback asked 24/5, 2017 at 14:36
1
Is it possible to define something like a generic match function over discriminated union type?
Let's say we have the following type definitions:
const Kinds = {
A: 'A',
B: 'B',
};
type Kind = t...
Frailty asked 26/11, 2016 at 21:34
2
Solved
I know about union types, but what does this pipe syntax mean?
let propName: "name" | "age" | "location";
Source: https://blogs.msdn.microsoft.com/typescript/2016/12/07/announcing-typescript-2-1...
Fin asked 5/1, 2017 at 1:22
2
We can generate partial type from strict type like below (from TypeScript 2.1):
type Partial<T> = {
[P in keyof T]?: T[P];
};
type Person = { name: string, age: number }
type PersonPartial...
Hypogenous asked 8/12, 2016 at 9:49
3
Solved
VM95422:27 ORIGINAL EXCEPTION:
WEBPACK_IMPORTED_MODULE_3_rxjs_Observable.Observable.zip is not a function
Tried various imports
// import 'rxjs/add/operator/zip';
// import 'rxjs/add/observab...
Toxin asked 16/5, 2017 at 13:29
2
(I have read this post but it is from August and it does not answer my question for the current typescript version.)
I'm currently using Typescript 1.8 in my project and this works fine:
import *...
Buskin asked 28/12, 2016 at 9:59
5
Solved
I have updated the angular packages version from 2.4.10 to 4.0.0 after updating i am getting the following errors while navigating.
ERROR Error: Uncaught (in promise): Error: Found the synthetic p...
Scrawl asked 24/3, 2017 at 8:5
1
Solved
I'm trying to cancel my async method call in Typescript.
To do this, I have created a new Promise type, which inherits from Promise:
class CancelablePromise<T> extends Promise<T>{
p...
Fetation asked 14/4, 2017 at 22:46
1
Solved
I thought I understood the purpose of the new TS 2.1 Pick type, but then I saw how it was being used in the React type definitions and I don't understand:
declare class Component<S> {
setSt...
Sonorant asked 6/3, 2017 at 2:27
1
© 2022 - 2024 — McMap. All rights reserved.