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

Add module declarations for svg and png ressources #458

Closed
wants to merge 1 commit into from

Conversation

ziegenberg
Copy link
Member

Removes a bunch of ts-expect-error:

// @ts-expect-error TS(2307): Cannot find module '../img/*.svg' or
// @ts-expect-error TS(2307): Cannot find module '../../img/*.png' or

@ziegenberg ziegenberg added the type:typing Add typing label May 24, 2024
@ziegenberg
Copy link
Member Author

@Arnei, would you consider this a valid approach?

@Arnei
Copy link
Member

Arnei commented May 24, 2024

Absolutely no expert on this, but if our goal is to get rid of @ts-expect-error messages, I would consider this a valid solution.

Apart from getting typescript to shut up, this does not add anything of value I believe. We're basically declaring pngs as any and svgs as string which is ... technically correct I suppose, but not actually all that useful? If we want good typing we should probably take a look at libraries like svgr. But that again begs the question if really need all that jazz. Certainly not if just want typescript to stop complaining.

And you can probably shorten the module declarations down to just declare module "*.png";? Not sure.

@geichelberger
Copy link
Contributor

While switching to Vite, I had to remove the ts-expect-error annotation. Else, tsc was complaining.

#471

Copy link
Contributor

This pull request has conflicts ☹
Please resolve those so we can review the pull request.
Thanks.

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
Copy link
Contributor

github-actions bot commented Jun 4, 2024

This pull request is deployed at test.admin-interface.opencast.org/458/2024-06-04_10-21-30/ .
It might take a few minutes for it to become available.

@ziegenberg
Copy link
Member Author

I rebased and fixed the merge conflicts.

@Arnei I also shortened the module declarations as suggested.

Copy link
Contributor

github-actions bot commented Jun 4, 2024

Use docker or podman to test this pull request locally.

Run test server using develop.opencast.org as backend:

podman run --rm -it -p 127.0.0.1:3000:3000 ghcr.io/opencast/opencast-admin-interface:pr-458

Specify a different backend like stable.opencast.org:

podman run --rm -it -p 127.0.0.1:3000:3000 -e PROXY_TARGET=https://stable.opencast.org ghcr.io/opencast/opencast-admin-interface:pr-458

It may take a few seconds for the interface to spin up.
It will then be available at http://127.0.0.1:3000.
For more options you can pass on to the proxy, take a look at the README.md.

@Arnei
Copy link
Member

Arnei commented Jun 4, 2024

Actually, do we still need this? Or did this become unnecessary with the introduction of vite and stuff?

@ziegenberg
Copy link
Member Author

@Arnei We still have messages like Cannot find module '../../img/*.png' or and they are gone with this patch.

@geichelberger
Copy link
Contributor

svgs should be handled by svgr

@ziegenberg
Copy link
Member Author

So, then let's close this.

@ziegenberg ziegenberg closed this Jun 12, 2024
@ziegenberg ziegenberg deleted the add-typing-for-images branch June 12, 2024 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:typing Add typing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants