-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chana/migrate analisis component to ts #56
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,7 @@ export default function MonthsSlider({ | |
setMonthRange(range); | ||
setDates({ min, max }); | ||
}, | ||
[], | ||
[globalDates.min, setDates], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how is setDates here ? it's a setter not a variable. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Setters, as all functions in javascript, are values and their pointers can change. This is why we use also, this was raising a warning from the linter, and I believe we should address linter warnings. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. then why aren't we passing setMonthRange ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. setMonthRange is stable by definition. The linter knows this since this PR from 2020. This component cannot know about the stability of its props. |
||
); | ||
|
||
return ( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,19 @@ | |
"isolatedModules": true, | ||
"noEmit": true, | ||
"jsx": "react-jsx", | ||
"plugins": [{ "name": "typescript-plugin-css-modules" }] | ||
"plugins": [{ "name": "typescript-plugin-css-modules" }], | ||
// https://www.typescriptlang.org/tsconfig#strictNullChecks | ||
"strictNullChecks": true, | ||
/* Indexed access of an Array<T> can return T, but if the index is out of bounds, it returns undefined. | ||
* This option makes the indexed access of Array<T> to evaluate to T | undefined. | ||
* | ||
* const numbers: Array = []; | ||
* // this should fail, type of test should be number | undefined | ||
* const test = numbers[0].toFixed(); | ||
* | ||
*/ | ||
// https://www.typescriptlang.org/tsconfig#noUncheckedIndexedAccess | ||
"noUncheckedIndexedAccess": true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. needs better description of why you're enabeling this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could the documentation do? I could just link There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. both =) |
||
}, | ||
"include": ["src"], | ||
"references": [{ "path": "./tsconfig.node.json" }] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a functional change and should go to it's own commit.
as a rule you should refrain to 'better the code' while migrating.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll keep it in mind in the future, but I believe this change is part of the migration. This does not change any functionality and fixes problems with Typescript.
You see, when you access
tipos.byName[t]
you don't have a guarantee that that doesn't evaluate toundefined
in Typescript. That's becausebyName
isn't aRecord<NarrowType, Whatever>
but aRecord<string, string>
, which makes it possible to accessbyName["someString"]
and getundefined
.If I hadn't changed this, I would have had typing errors. In my opinion this change is pertinent to the commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then the right way is to put it in another commit explaining exactly what you wrote here.