typescript2.0 Questions
4
Solved
Using tsc v2.2.2
How to fix typescript compiler error:
error TS4058: Return type of exported function has or is using name
'{SomeInterface}' from external module
"{some path}/dist/types"
...
Radish asked 11/4, 2017 at 1:32
5
I have this:
$ tsc -m amd --outFile dist/out.js lib/index.ts
lib/index.ts(87,48): error TS1005: ';' expected.
Is there a command line option I can use to ignore errors?
Gallop asked 11/1, 2018 at 5:8
4
I'm using Typescript (version 2.2.1) in VSCode (version 1.10.2) for my React Native project and I'm trying to get the compiler to map *.android.ts and *.ios.ts paths by using the instructions at:
...
Monney asked 28/3, 2017 at 0:48
4
Is there a way to enforce typescript to even more strict typechecking up to per alias checks?
What I want to achieve is to define types, such as:
type kilograms = number;
type kilometers = number...
Monikamoniker asked 22/1, 2017 at 11:37
7
I installed the knockout definitions using the documented method like this.
npm install @types/knockout
It works nicely, I could import it like this anywhere.
import * as ko from "knockout";
...
Delanadelancey asked 4/10, 2016 at 13:37
2
Solved
I have an enum definition in module 'some-lib'. I want to re-export it from a namespace in my module, something like this:
import { PaymentType } from 'some-lib';
namespace Payout {
export enum ...
Corroboration asked 7/12, 2017 at 18:11
5
Edit: I'm using TypeScript v2.2.1
I am new to TypeScript and I'm not sure what the cleanest way of dealing with DOM elements that may or may not exist is. Basically, I want to check whether an ele...
Overton asked 4/4, 2017 at 22:22
6
Solved
Consider a simple typescript project with the following directory structure:
| package.json
| tsconfig.json
|
\---src
| app.ts
|
\---foobar
Foo.ts
Bar.ts
tsconfig.json has been configured...
Priedieu asked 21/2, 2017 at 0:18
2
Solved
I've been researching around for a further explanation into the skipLibCheck TypeScript compiler argument to determine the safety of having this set to true. The most in-depth explanation I found i...
Vestige asked 13/9, 2018 at 10:27
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
11
Suppose I have two enums as described below in Typescript, then How do I merge them
enum Mammals {
Humans,
Bats,
Dolphins
}
enum Reptiles {
Snakes,
Alligators,
Lizards
}
export default Mamm...
Farhi asked 27/1, 2018 at 17:16
28
I have a very simple functional component as follows:
import * as React from 'react';
export interface AuxProps {
children: React.ReactNode
}
const aux = (props: AuxProps) => props.childr...
Pow asked 9/12, 2018 at 2:38
9
Solved
My question is very brief. I am new to TypeScript, been searching around here and there but didn't find yet an answer.
Does any experienced TypeScripter know if there is a character Type or an eas...
Logotype asked 8/3, 2017 at 18:16
1
I am trying to add eslint-plugin-security in a TypeScript project. However, for these codes
import { promises as fsp } from 'fs';
import fs from 'fs';
import path from 'path';
const index = await ...
Preeminence asked 5/8, 2020 at 9:55
8
Solved
I having this condition on a form group:
if((age>17 && (this.frType=="Infant"))
|| (age>40 && this.frType=="Grandchild")
|| (age<=5 &&
(this.frType!="Child"
|...
Unpolitic asked 11/12, 2018 at 7:59
12
Solved
I was trying to create a <PrivateRoute> as describe in the react-router documents using TypeScript. Can anyone help me out?
The privateRoute in react-router document:
const PrivateRoute = ({ ...
Donets asked 11/12, 2017 at 6:52
4
Solved
I have this situation. The reason they are dynamic is to prevent loading 10x the amount of code that I need to load to do a certain command-line task.
if (diagnostics) {
require('./lib/cli-comman...
Imparipinnate asked 1/12, 2017 at 4:22
4
Could you please help importing a TypeScript2 Vuejs2 component from another TypeScript2 Vuejs2 component?
Target module (MyTable.vue)
<script lang="ts">
export default {}
</script>
...
Herrod asked 22/3, 2017 at 7:37
6
Solved
For either case:
document.getElementById('body');
// or
window.document.getElementById('body');
I get error TS2304: Cannot find name 'window'.
Am I missing something in tsconfig.json for a defi...
Crinose asked 26/12, 2016 at 21:9
3
Solved
assuming I have this type:
type FooArray = IFoo[] | number[] | undefined
is it possible to extract just IFoo from this?
Thievish asked 14/9, 2018 at 11:2
3
Solved
Right now I have this in a custom .d.ts file:
import { Request, Response, NextFunction } from 'express';
export type MiddleWareFn = (req: Request, res: Response, next: NextFunction) => void;
...
Iodometry asked 28/2, 2018 at 2:10
3
Solved
When working on a TypeScript (v2.0+) project within 'Visual Studio Code' (v1.5.3) I get the following error:
[Error - 10:03:50 AM] 'format' request failed with error.
Error processing request. No ...
Hearn asked 28/9, 2016 at 15:12
3
Solved
I have tried this case:
let a = { id: 1, name: "Misha" };
function b(id: number, name: string) {
}
b(...a);
I need that all properties of object will be applied as parameters
Dizen asked 4/10, 2019 at 11:35
9
Solved
If I'd like to assign a type to a variable that will later be assigned a setInterval like so:
this.autoSaveInterval = setInterval(function(){
if(this.car.id){
this.save();
}
else{
this.create...
Wongawonga asked 17/7, 2018 at 8:27
7
Solved
When I enable noImplicitThis in tsconfig.json, I get this error for the following code:
'this' implicitly has type 'any' because it does not have a type
annotation.
class Foo implements EventEmit...
Urbanize asked 30/1, 2017 at 20:16
1 Next >
© 2022 - 2024 — McMap. All rights reserved.