-
Notifications
You must be signed in to change notification settings - Fork 44
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
Refactor JavaScript to TypeScript #81
Conversation
src/types/generic.ts
Outdated
@@ -0,0 +1,262 @@ | |||
import {HomeAssistant} from "custom-card-helpers"; | |||
|
|||
export namespace generic { |
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 wonder if there is a risk overusing namespaces?
Will prefixing all these types with generic
make the code a little less concise and readable?
My experience says namespaces are used in huge codebases where identical names of types needs to be separated. I am not convinced namespaces are really needed in this codebase though.
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.
Just for now it's name-spaced to avoid such conflicts and for my own recognition.
It's a good comment though. The ones I need to optimize the code.
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.
So it is a definite no on removing namespace? 😄
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.
Nope. I haven't gotten around to it yet and I really like to merge this PR since it disrupts other PRs.
src/types/generic.ts
Outdated
@@ -0,0 +1,262 @@ | |||
import {HomeAssistant} from "custom-card-helpers"; | |||
|
|||
export namespace generic { |
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.
So it is a definite no on removing namespace? 😄
All of the other options use snake case, ex |
@AalianKhan Since merging this PR into If so, I'll need to force push my local Warning If I change the history of the |
I don't believe so. |
Other changes include: * Add Vacuum Card and View. * Add hiding sections from the Home view by strategy configuration. * Add hiding a view if no device is configured for it. Closes #24. * Add color temperature to light card. * Add icon to HomeView configuration. * Add version output to console. * Add version bumper. * Add .editorconfig settings. * Refactor README, because the information moved to the repository's Wiki. Closes #87.
b6cbc79
to
12e4d76
Compare
I've refactored the JavaScript files to TypeScript.
TypeScript is JavaScript with syntax for types and also used by Home Assistant.
It allows developers to precisely define the expected shape of objects and function parameters, resulting in code that's easier to understand and maintain.
Please test this code very carefully, so we're sure it matches the JavaScript version.