Questions tagged [TypeScript] (498)

1
answer

How to access chrome in Angular?

In angular, how to access chrome.... runtime component?
Stephanie_Maggio asked April 4th 20 at 14:21
1
answer

What does this entry in TypeScript?

public subscribe(channel: string, handler: (value: any) => void) { return this.data.subscribe(handler); } Does this mean that the second argument is a function with a parameter value? And that it is returned as the result from a function? What will return the function subscribe
Felicity_Grady10 asked April 4th 20 at 14:10
2
answers

How to describe the event in the ts input?

<input onKeyUp={onKeyUp} /> const onKeyUp = (e) => { if (e.keyCode === 13) { e.target.blur(); } }; how to describe function onKeyUp in aid of ts right?
Ariel.Rober asked April 4th 20 at 14:09
2
answers

As for TypeScript to declare a library function in JS?

Write a tool to TypeScript. There is a need to use the library: npm i ad Types it is not found. Slowly he tried to create for themselves. And do not understand how to declare function types: ad.user().get(filter) await the ad.user().get({fields: 'sAMAccountName'}); ad.user().add(options) await the ad.user().add({ userNam...
Jody.Nitzsche asked April 4th 20 at 14:09
1
answer

How to assign the type of the variables (events and html element)?

There is a code that works, but the IDE complains: currentElement can be null export function verifyRequired (event: { target: HTMLInputElement }, ignoreError: boolean = false) { updateStepButton(ignoreError) const currentElement: HTMLInputElement = event.target const parentElement = currentElement.parentNode.querySe...
Suzanne_Hell asked April 4th 20 at 14:06
2
answers

How to use this in arrow functions in typescript?

Try to use this in arrow functions, pre-specifying a type for this. I get this error: An arrow function cannot have a 'this' parameter.ts(2730) According to this PR ( https://github.com/Microsoft/TypeScript/pull/6739 ) in typescript, you can use this pointer in functions this way. On the Internet there is absolutely no hi...
dedric_Koelpin14 asked April 4th 20 at 14:03
1
answer

Error when importing in node js?

The error itself import httpRequest from './httpRequest'; ^^^^^^^^^^^ SyntaxError: Unexpected identifier Code file import httpRequest from './httpRequest'; const http = require('http'); const PORT = 3000; const app = http.createServer((req: any, res: any) => { Res. end('Hello World!\n'); httpRequest.sendRequest(idCo...
Ramona_Durgan asked April 4th 20 at 13:59
2
answers

How to open a typescript module with export to global scope?

Good time of day. Typescript + webpack when you compile a simple class file with this class available for the treatment of globalno. If you add export / import file is executed, but the global class is not available. How to fix? Assuming you can somehow separately to compile ts files without importing, after collecting into...
Francesc asked April 4th 20 at 13:55
1
answer

Node.js — ts-node: Unexpected token ':'?

I write backend server for your application and decided to change the executor from babel-node on the ts-node. My team package.json: "server": "cd server && ts-node --project tsconfig.json -ts r-node/Server register.ts", But get the same error: > nodejs-server@1.0.0 server D:\Projects\Visual Studio Code\NodeJS Se...
hailey_Wisozk asked April 4th 20 at 13:52
2
answers

How to export from the circuit in TypeScript?

Make a plugin for typescript, you need to create a closure in order not to break someone else's code by accident. Without circuit protection is exported normally:class Model { settings = { min: 0, max: 100 }; constructor(options: Object) { this.settings = $.extend(this.settings, options); } static pow(num: number, p...
julianne_White asked April 4th 20 at 13:41