Repository navigation
fix(maplibre): align map props with MapOptions #2612
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
Changes from 1 commit
15fbffa
6b806ff
66d2898
4aaf8d6
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 |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import type {ComponentProps} from 'react'; | ||
| import Map from 'react-map-gl/maplibre'; | ||
| import type {MapOptions} from 'maplibre-gl'; | ||
|
|
||
| type MapProps = ComponentProps<typeof Map>; | ||
|
|
||
| type MutableMapOptionKeys = | ||
| | 'minZoom' | ||
| | 'maxZoom' | ||
| | 'minPitch' | ||
| | 'maxPitch' | ||
| | 'maxBounds' | ||
| | 'renderWorldCopies'; | ||
|
|
||
| declare const mapOptions: Pick<MapOptions, MutableMapOptionKeys>; | ||
| const mapProps: Pick<MapProps, MutableMapOptionKeys> = mapOptions; | ||
| const nullableCameraConstraints: Pick<MapProps, 'minZoom' | 'maxZoom' | 'minPitch' | 'maxPitch'> = { | ||
| minZoom: null, | ||
| maxZoom: null, | ||
| minPitch: null, | ||
| maxPitch: null | ||
| }; | ||
|
|
||
| void mapProps; | ||
|
Contributor
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. Is this something this project does? Also the declare above.
Contributor
Author
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. You’re right. This pattern is not established in the repository, so I removed it. |
||
| void nullableCameraConstraints; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "extends": "../../tsconfig.json", | ||
|
Contributor
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. Personally I don't understand this part. Like the whole "consumer test".
Contributor
Author
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. Agreed. I removed the standalone consumer test. The types now derive directly from |
||
| "compilerOptions": { | ||
| "allowJs": false, | ||
| "noEmit": true, | ||
| "strictNullChecks": true, | ||
| "paths": { | ||
| "react-map-gl/maplibre": ["../../modules/main/dist/maplibre.d.ts"] | ||
| } | ||
| }, | ||
| "include": ["maplibre-map-props.ts"] | ||
| } | ||
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.
Are those not number/undefined/null?
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.
Yes — optional React props also include
undefined. Updated the docs to show the full type.