Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Proposed Task: Migrate from Javascript to Typescript #782

Open
s0mya opened this issue Oct 14, 2021 · 1 comment
Open

Proposed Task: Migrate from Javascript to Typescript #782

s0mya opened this issue Oct 14, 2021 · 1 comment

Comments

@s0mya
Copy link

s0mya commented Oct 14, 2021

Typescript can help detect errors earlier in the workflow and results in easier to understand code.

E.g. Let's look at Props for example
Javascript: No requirement to declare the type of Props. Any property can be passed. Invalid prop usage is not detected until runtime.
const JSComponent = (props) => {
return (

{props.x} {props.y} {props.anotherInvalidProp}
); }

Typescript: Exact props type must be specified. Errors are highlighted at compile time and it’s much easier to identify the component interface.
interface Props {
x: number,
y: number
}

const TSComponent = (props: Props) => {
return (


{props.x}
{props.y}
{props.anotherInvalidProp}

);
}

Fortunately it’s possible to migrate at your own pace: https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html

@s0mya s0mya added this to the Bigger tickets milestone Oct 14, 2021
@s0mya
Copy link
Author

s0mya commented Oct 14, 2021

@TristanThrush @douwekiela Can you review you agree with this task?

@s0mya s0mya changed the title Recommended Task: Migrate from Javascript to Typescript Proposed Task: Migrate from Javascript to Typescript Oct 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant