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

Typing /app/src/utils/utils.ts #209

Merged
merged 7 commits into from
Mar 5, 2024

Conversation

Arnei
Copy link
Member

@Arnei Arnei commented Sep 29, 2023

First foray into typing, starting with simple stuff.

Also adds interfaces for user information, so we should think about

  • Do we want to primarily use interface or type? Or do we want to leave it up to developers to choose what they feel is right?
  • Do we want to put interfaces together with code, or do we want seperate files for them?

First foray into typing, starting with simple stuff.

Also adds interfaces for user information, so we should think about
- Do we want to primarily use `interface` or `type`? Or do we want
to leave it up to developers to choose what they feel is right?
- Do we want to put interfaces together with code, or do we want
seperate files for them?
@Arnei Arnei added the type:typing Add typing label Sep 29, 2023
@JulianKniephoff
Copy link
Member

Just my 2 cents regarding the questions you raised:

AFAIK you want type by default. If you use an interface you should do so because you need one of the (increasingly) few features interfaces have but types don't. (Declaration merging for example.)

Good summary: https://www.youtube.com/watch?v=zM9UPcIyyhQ

Regarding where to put stuff: I'm not a big fan of putting things in their own files because of the way they are declared or something like that. A file per interface or all interfaces in one file or stuff like that makes no sense to me. Types are just variables, and like variables they should be declared as close to their usage as we can get away with. If only a single function needs a type, it should be declared in that function. 🤷‍♀️

@Arnei
Copy link
Member Author

Arnei commented Oct 9, 2023

Good summary: https://www.youtube.com/watch?v=zM9UPcIyyhQ
"If you just like the word "interface", like, you know, you've come from object oriented programming, then use an interface".

It me.

But sure, we can do types per default. Will get around to changing that, hopefully.

Arnei added 5 commits October 11, 2023 14:05
Can only do that for `IInfoMe` though, since `extends` can only be
used with `interface`.
Instead of typing the response, we can directly type the get request
instead, making for a clearer statement of intend
Thought about this and ultimately think that prefixing types with "I"
just to make clear that they're types is not helpful anymore in this
day and age.
It's in the same file as UserInfo, so ... *shrug*
Copy link
Contributor

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

@Arnei Arnei merged commit 3d9d88f into opencast:admin-ui-picard Mar 5, 2024
1 check passed
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.

2 participants