Вопросы с тегом «typescript2.0»

2
Какой тип записи в машинописи?
Что Record<K, T>значит в Typescript? Typescript 2.1 представил Recordтип, описав его в примере: // For every properties K of type T, transform it to U function mapObject<K extends string, T, U>(obj: Record<K, T>, f: (x: T) => U): Record<K, U> см. Typescript 2.1 И Advanced Типы страницы упоминается Recordпод отображенных …

13
TypeScript и React - детский тип?
У меня есть очень простой функциональный компонент: import * as React from 'react'; export interface AuxProps { children: React.ReactNode } const aux = (props: AuxProps) => props.children; export default aux; И еще один компонент: import * as React from "react"; export interface LayoutProps { children: React.ReactNode } const layout = …

1
'this' неявно имеет тип 'any', потому что не имеет аннотации типа
Когда я включаю noImplicitThisв tsconfig.json, я получаю эту ошибку для следующего кода: 'this' implicitly has type 'any' because it does not have a type annotation. class Foo implements EventEmitter { on(name: string, fn: Function) { } emit(name: string) { } } const foo = new Foo(); foo.on('error', function(err: any) { …
Используя наш сайт, вы подтверждаете, что прочитали и поняли нашу Политику в отношении файлов cookie и Политику конфиденциальности.
Licensed under cc by-sa 3.0 with attribution required.