Skip to content

Commit 30e8ce1

Browse files
committed
Translate 'Using TypeScript'
1 parent ea81704 commit 30e8ce1

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/content/learn/typescript.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Using TypeScript
2+
title: TypeScriptin käyttäminen
33
re: https://github.com/reactjs/react.dev/issues/5960
44
---
55

@@ -18,7 +18,7 @@ TypeScript is a popular way to add type definitions to JavaScript codebases. Out
1818

1919
</YouWillLearn>
2020

21-
## Installation {/*installation*/}
21+
## Asennus {/*installation*/}
2222

2323
All [production-grade React frameworks](https://react-dev-git-fork-orta-typescriptpage-fbopensource.vercel.app/learn/start-a-new-react-project#production-grade-react-frameworks) offer support for using TypeScript. Follow the framework specific guide for installation:
2424

@@ -27,7 +27,7 @@ All [production-grade React frameworks](https://react-dev-git-fork-orta-typescri
2727
- [Gatsby](https://www.gatsbyjs.com/docs/how-to/custom-configuration/typescript/)
2828
- [Expo](https://docs.expo.dev/guides/typescript/)
2929

30-
### Adding TypeScript to an existing React project {/*adding-typescript-to-an-existing-react-project*/}
30+
### TypeScriptin lisääminen olemassa olevaan React projektiin {/*adding-typescript-to-an-existing-react-project*/}
3131

3232
To install the latest version of React's type definitions:
3333

@@ -41,7 +41,7 @@ The following compiler options need to be set in your `tsconfig.json`:
4141
1. [`jsx`](https://www.typescriptlang.org/tsconfig/#jsx) must be set to one of the valid options. `preserve` should suffice for most applications.
4242
If you're publishing a library, consult the [`jsx` documentation](https://www.typescriptlang.org/tsconfig/#jsx) on what value to choose.
4343

44-
## TypeScript with React Components {/*typescript-with-react-components*/}
44+
## TypeScript React komponenteissa {/*typescript-with-react-components*/}
4545

4646
<Note>
4747

@@ -122,7 +122,7 @@ export default App = AppTSX;
122122
The type describing your component's props can be as simple or as complex as you need, though they should be an object type described with either a `type` or `interface`. You can learn about how TypeScript describes objects in [Object Types](https://www.typescriptlang.org/docs/handbook/2/objects.html) but you may also be interested in using [Union Types](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types) to describe a prop that can be one of a few different types and the [Creating Types from Types](https://www.typescriptlang.org/docs/handbook/2/types-from-types.html) guide for more advanced use cases.
123123

124124

125-
## Example Hooks {/*example-hooks*/}
125+
## Hookki-esimerkkejä {/*example-hooks*/}
126126

127127
The type definitions from `@types/react` include types for the built-in hooks, so you can use them in your components without any additional setup. They are built to take into account the code you write in your component, so you will get [inferred types](https://www.typescriptlang.org/docs/handbook/type-inference.html) a lot of the time and ideally do not need to handle the minutiae of providing the types.
128128

@@ -371,11 +371,11 @@ export default function Form() {
371371
}
372372
```
373373

374-
## Useful Types {/*useful-types*/}
374+
## Hyödyllisiä tyyppejä {/*useful-types*/}
375375

376376
There is quite an expansive set of types which come from the `@types/react` package, it is worth a read when you feel comfortable with how React and TypeScript interact. You can find them [in React's folder in DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react/index.d.ts). We will cover a few of the more common types here.
377377

378-
### DOM Events {/*typing-dom-events*/}
378+
### DOM tapahtumat {/*typing-dom-events*/}
379379

380380
When working with DOM events in React, the type of the event can often be inferred from the event handler. However, when you want to extract a function to be passed to an event handler, you will need to explicitly set the type of the event.
381381

@@ -437,7 +437,7 @@ Note, that you cannot use TypeScript to describe that the children are a certain
437437

438438
You can see all an example of both `React.ReactNode` and `React.ReactElement` with the type-checker in [this TypeScript playground](https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAJQKYEMDG8BmUIjgIilQ3wChSB6CxYmAOmXRgDkIATJOdNJMGAZzgwAFpxAR+8YADswAVwGkZMJFEzpOjDKw4AFHGEEBvUnDhphwADZsi0gFw0mDWjqQBuUgF9yaCNMlENzgAXjgACjADfkctFnYkfQhDAEpQgD44AB42YAA3dKMo5P46C2tbJGkvLIpcgt9-QLi3AEEwMFCItJDMrPTTbIQ3dKywdIB5aU4kKyQQKpha8drhhIGzLLWODbNs3b3s8YAxKBQAcwXpAThMaGWDvbH0gFloGbmrgQfBzYpd1YjQZbEYARkB6zMwO2SHSAAlZlYIBCdtCRkZpHIrFYahQYQD8UYYFA5EhcfjyGYqHAXnJAsIUHlOOUbHYhMIIHJzsI0Qk4P9SLUBuRqXEXEwAKKfRZcNA8PiCfxWACecAAUgBlAAacFm80W-CU11U6h4TgwUv11yShjgJjMLMqDnN9Dilq+nh8pD8AXgCHdMrCkWisVoAet0R6fXqhWKhjKllZVVxMcavpd4Zg7U6Qaj+2hmdG4zeRF10uu-Aeq0LBfLMEe-V+T2L7zLVu+FBWLdLeq+lc7DYFf39deFVOotMCACNOCh1dq219a+30uC8YWoZsRyuEdjkevR8uvoVMdjyTWt4WiSSydXD4NqZP4AymeZE072ZzuUeZQKheQgA).
439439

440-
### Style Props {/*typing-style-props*/}
440+
### Tyylipropsit {/*typing-style-props*/}
441441

442442
When using inline styles in React, you can use `React.CSSProperties` to describe the object passed to the `style` prop. This type is a union of all the possible CSS properties, and is a good way to ensure you are passing valid CSS properties to the `style` prop, and to get auto-complete in your editor.
443443

@@ -447,7 +447,7 @@ interface MyComponentProps {
447447
}
448448
```
449449

450-
## Further learning {/*further-learning*/}
450+
## Lisää opeteltavaa {/*further-learning*/}
451451

452452
This guide has covered the basics of using TypeScript with React, but there is a lot more to learn.
453453
Individual API pages on the docs may contain more in-depth documentation on how to use them with TypeScript.

0 commit comments

Comments
 (0)