Skip to content
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

fix: Upgrade mapbox-gl #1400

Open
wants to merge 6 commits into
base: feat#1289-simplified-aoi-creation
Choose a base branch
from

Conversation

AliceR
Copy link
Member

@AliceR AliceR commented Jan 23, 2025

I am attempting to upgrade mapbox-gl, in order to use the fitBounds with alternative projections. Version 3.5 introduces breaking changes to the type system, which I was able to address in e227a9d. I have some issues left that I need help with, also need someone with better understanding of our veda typings to have a proper look at my changes.
@sandrahoang686 maybe? 😊

@AliceR AliceR requested review from hanbyul-here, sandrahoang686 and dzole0311 and removed request for hanbyul-here and sandrahoang686 January 23, 2025 10:09
Copy link

netlify bot commented Jan 23, 2025

Deploy Preview for veda-ui ready!

Name Link
🔨 Latest commit e40b575
🔍 Latest deploy log https://app.netlify.com/sites/veda-ui/deploys/679b5a16cb583800076b6afc
😎 Deploy Preview https://deploy-preview-1400--veda-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@dzole0311
Copy link
Collaborator

@AliceR I think the issue is a mismatch between the ProjectionOptions in veda.ts and ProjectionOptions in index.d.ts 🤔 Updating the one in the module definition file (parcel-resolver-veda/index.d.ts) seems to resolve the TS errors:

  export type ProjectionOptions = {
    id: mapboxgl.ProjectionSpecification['name'] | 'polarNorth' | 'polarSouth';
    parallels?: number[];
    center?: [number, number];
  };

@AliceR
Copy link
Member Author

AliceR commented Jan 23, 2025

Thanks @dzole0311 , this indeed fixed all the ts errors. I am still not sure if I solved all the issues correctly... And now I even wonder why we have this duplication between app/scripts/types/veda.ts and parcel-resolver-veda/index.d.ts... 🤔

@sandrahoang686
Copy link
Collaborator

sandrahoang686 commented Jan 23, 2025

hey @AliceR 👋🏼 . Just saw your question in the description but what could I help out with specifically when it comes to typing? There is lots going on with it and much improvement in our codebase needed for it 😄 . A few things I can summarize right now though that might help out..

  1. When it comes to casting, (someType as otherType) this generally isn't good practice because it means we are masking ill defined type interfaces or bad transformations or dont have the correct types. There is actually already a good amount of this happening in the veda-ui codebase which has been noted as tech-debt (a tech-debt ticket here). Looks like a good amount of casting is going on in this PR as well which means we should probably look at the type definitions and clean it up
  2. Like Hanbyul mentioned, we want to decouple from veda virtual modules so any types under parser-resolver-veda/* we wont want to use and should use $types/veda. Most types exist there already I believe, if not, we'd just want to copy them over
  3. If we want types to be exposed to the NextJs instance to use, these types of have to defined in a *.ts file instead of a *.d.ts file. Context from this PR here.

lmk if I could help assist in any of these areas :)

@AliceR
Copy link
Member Author

AliceR commented Jan 23, 2025

Thank you for the context @sandrahoang686 , it makes a lot of sense!

The only thing missing here then would be a review decision: can this PR be merged as is, and if not, which of the tech debt should we include?

@@ -206,7 +206,7 @@ function MapBlock(props: MapBlockProps) {
parallels: projectionParallels
});
return {
...projection,
Copy link
Member Author

@AliceR AliceR Jan 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spread types may only be created from object types.ts(2698)

const projection: MbProjectionOptions

const metadata: ExtendedMetadata = generatorLayer.metadata ?? {};
metadata.generatorId = generatorId;
const metadata: ExtendedMetadata = {
...(generatorLayer.metadata ?? {}),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
...(generatorLayer.metadata ?? {}),
...generatorLayer.metadata

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, this will only work if we don't pass unknown to the metadata?: ExtendedMetadata.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we create a tech debt ticket to clean up typings around maps/sources/metadata? This seems to be a bit of a 🧶 (alt: a knotty situation)

@AliceR AliceR requested a review from dzole0311 January 30, 2025 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants