-
Notifications
You must be signed in to change notification settings - Fork 30
Correct README.md #2
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
Conversation
The removed lines below are actually allowed in typescript. // ❌ This is not allowed due to type safety // const selectedType2: MediaTypes = MediaTypes.Video; // ❌ This is not allowed due to type safety // const invalidType: MediaTypes = 'image';
README.md
Outdated
// ✅ Accessing the value | ||
const associatedText: string = MediaTypes.Image; | ||
|
||
// ❌ This is not allowed due to type safety | ||
// const invalidType: MediaTypes = 'image'; |
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.
This statement is not allowed because Assigning a string like 'image' to a variable of an enum type (MediaTypes) is a type error in TypeScript
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, thank you for correcting me :)
@@ -314,14 +314,9 @@ enum MediaTypes { | |||
|
|||
const selectedType: MediaTypes = MediaTypes.Image; | |||
|
|||
// ❌ This is not allowed due to type safety | |||
// const selectedType2: MediaTypes = MediaTypes.Video; |
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.
thank you!
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.
can you please un-remove lines323-324? Thank you for making this better! Much appreciated!
Done! |
Kindly merge it if it looks good now @Devinterview-io |
The removed lines below are actually allowed in typescript.