You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Desarrollo de Sistemas de Diseño](#desarrollo-de-sistemas-de-diseño)
80
82
-[Migrando desde Flow](#migrando-desde-flow)
81
83
-[Prettier](#prettier)
84
+
-[Testing](#testing)
82
85
-[Linting](#linting)
83
86
-[Trabajar con bibliotecas que no son de TypeScript (escribe tu propio index.d.ts)](#trabajar-con-bibliotecas-que-no-son-de-typeScript-escribe-tu-propio-indexdts)
84
87
-[Sección 4: @types/react y @types/react-dom APIs](#sección-4-typesreact-y-typesreact-dom-apis)
85
88
-[Agregando atributos no estandarizados](#agregando-atributos-no-estandarizados)
86
89
-[@types/react-dom](#types-react-dom)
87
-
88
90
</details>
89
91
90
92
# Sección 0: Tipos de utilidad
@@ -699,7 +701,8 @@ Como puede ver en el ejemplo anterior de Omitir, también puede escribir una ló
699
701
700
702
_(Contribuido por [@ferdaber](https://github.com/typescript-cheatsheets/react-typescript-cheatsheet/issues/63))_
701
703
702
-
Hay muchos lugares donde desea reutilizar algunas piesas de props debido a _props drilling_, para que pueda exportar el tipo de accesorios como parte del módulo o extraerlos (de cualquier manera funciona).
704
+
Hay muchos lugares donde desea reutilizar algunas piesas de props debido a _props drilling_,
705
+
para que pueda exportar el tipo de accesorios como parte del módulo o extraerlos (de cualquier manera funciona).
703
706
704
707
La ventaja de extraer los tipos de props es que no necesitas exportar todo. Y el componente fuente se propagará a todos los componentes consumidores.
705
708
@@ -756,8 +759,7 @@ class DateIsInFutureError extends RangeError {}
756
759
function parse(date:string) {
757
760
if (!isValid(date))
758
761
thrownewInvalidDateFormatError("no es un formato de fecha válido");
759
-
if (isInFuture(date))
760
-
thrownewDateIsInFutureError("la fecha es en el futuro");
762
+
if (isInFuture(date)) thrownewDateIsInFutureError("la fecha es en el futuro");
Más información: https://github.com/basarat/typescript-book/blob/master/docs/jsx/react.md#react-jsx-tip-generic-components
895
896
897
+
## TypeScript 3.0
898
+
899
+
[[Notas de la versión](https://github.com/Microsoft/TypeScript/releases/tag/v3.0.1) | [Publicación del blog](https://blogs.msdn.microsoft.com/typescript/2018/07/30/announcing-typescript-3-0/)]
900
+
901
+
1. Parametros rest con tipo para escribir argumentos de longitud variable:
902
+
903
+
```ts
904
+
// `rest` acepta cualquier numero de strings - incluso ninguno!
905
+
function foo(...rest:string[]) {
906
+
// ...
907
+
}
908
+
909
+
foo("hello"); // funciona
910
+
foo("hello", "world"); // también funciona
911
+
```
912
+
896
913
2. Soporte para `propTypes` y`staticdefaultProps` en JSX usando `LibraryManagedAttributes`:
Consulte también [Notas de la actualización de Google a 3.5](https://github.com/microsoft/TypeScript/issues/33272)
1072
1089
1073
-
## TypeScript Roadmap
1090
+
## TypeScript 3.6
1091
+
1092
+
[[Notas de la versión](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-6.html) | [Publicación del blog](https://devblogs.microsoft.com/typescript/announcing-typescript-3-6/)]
1093
+
1094
+
Nada es particularmente específico de React, pero [el playground](https://github.com/agentcooper/typescript-play) recibió una actualización y [Las clases Ambientales y Funciones pueden fusionarse](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-6.html#ambient-classes-and-functions-can-merge)
1095
+
1096
+
## TypeScript 3.7
1097
+
1098
+
[[Notas de la versión](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html) | [Publicación del blog](https://devblogs.microsoft.com/typescript/announcing-typescript-3-7/)]
Esto está configurado para ti en [tsdx](https://github.com/palmerhq/tsdx/pull/45/files).
1220
-
1221
-
## Linting
1222
-
1223
-
> ⚠️ Nota que [TSLint ahora está en mantenimiento y deberías intentar usar ESLint en su lugar](https://medium.com/palantir/tslint-in-2019-1a144c2317a9). Si está interesado en los consejos de TSLint, consulte este PR desde [@azdanov](https://github.com/typescript-cheatsheets/react-typescript-cheatsheet/pull/14). El resto de esta sección solo se centra en ESLint.
1224
-
1225
-
> ⚠️ Este es un tema en evolución. `typescript-eslint-parser` ya no se mantiene y [el trabajo ha comenzado recientemente sobre`typescript-eslint` en la comunidad ESLint](https://eslint.org/blog/2019/01/future-typescript-eslint) para lleve ESLint con TSLint.
1226
-
1227
-
Siga los documentos de TypeScript + ESLint en https://github.com/typescript-eslint/typescript-eslint:
Puede leer una [guía de configuración más completa de TypeScript + ESLint aquí](https://blog.matterhorn.dev/posts/learn-typescript-linting-part-1/) de Matterhorn, en particular consulte https://github.com/MatterhornDev/learn-typescript-linting.
0 commit comments