-
Notifications
You must be signed in to change notification settings - Fork 26
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
Convert AddressPage.js to TSX. #346
Conversation
type Addr = { | ||
housenumber: string; | ||
streetname: string; | ||
zip: string; | ||
boro: string; | ||
bbl: string; | ||
yearbuilt: number; | ||
unitsres: number; | ||
rsunits2007: number; | ||
rsunits2017: number; | ||
openviolations: number; | ||
totalviolations: number; | ||
evictions: string | null; | ||
ownernames: { title: string; value: string }[]; | ||
lastsaledate: string; | ||
lastsaleamount: string; | ||
lastsaleacrisid: string; | ||
}; |
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.
Well, at least we're getting rid of this duplicate typing.
super(props); | ||
|
||
this.state = { | ||
searchAddress: { ...props.match.params }, // maybe this should be | ||
userAddr: {}, // merged together? | ||
hasSearched: false, | ||
geosearch: {}, |
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'm a bit queasy about this change but hopefully it should work. We should probably kick the tires a bit just to make sure nothing explodes...
@toolness this is ready for your eyes again! |
awesome thanks @sraby ! |
This converts
AddressPage.js
to TSX.Crucially, though, most of the address-related state fields are typed toany
, which makes some of this incomplete. Those fields are going to take a lot of work to properly type because of how they're being used, and how they interact with some components further down in the component hierarchy (some of which are still untyped). It might ultimately be easier to just refactor the data model to be more comprehensible, rather than attempting to add types as-is.Note that this introduces an explicit
throw
for the situation where an address search has no geosearch information; this essentially means that the error signature for #340 will now be different, as it will be an explicit exception rather thanCannot get property 'bbl' of undefined or null
.