We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
All declarations of '{property}' must have identical modifiers JSDoc Symbol Property Modifiers
This is the behavior in every version I tried (4.X.X - 5.X.X)
https://www.typescriptlang.org/play/?ts=5.7.2&filetype=js#code/MYewdgzgLgBA1gIQIYCcYF4YGUCeBbAIxABsAKAIgNXIEoBuAKAeGKQghgDMQQAGGAN4MYImAHoAVBOGiYEmAAEADihBQApsA0ATGaPkKoOJesEwwAV2LEYAHxjQUASzABzGAF89IiWO8BtRFQAXQxzK2I6cTEYAB4AWniYAEFrGG1NVhQkKCdwDhBOGAByQOQUYOKYPAtoGAALJAA3UycMsFzgJBs8EG0nTid1FAgmWVd1WCoUUhpBb1kUSYsUMBgoeqcIMpDGWS9ZSWlZOUUjEzNHF3cD2V9vCEmYadIm7ot1OaET0Q2tnYqYTexA+e1EXi8zFY7C4PAAjPNDlIFgYVGpNDoUWdjKYBOE0vYrm5PCi-LIAPrk6ZhSzWKJiGIJJIAeTgY1EEymqFmiJ+MCWUBWaz+EAAdJTpmCRLcREcsYYcZcoM5iTKfGTRI8uTNgR8vgtfpsxRLUED3uopSSPEA
const kBar = Symbol("bar"); class foo0 { /** * @protected * @type { null | string } */ [kBar] = null; // <-- All declarations of '[kBar]' must have identical modifiers get bar() { return this[kBar]; } /** * @type { string } */ set bar(value) { this[kBar] = value; } }
All declarations of '[kBar]' must have identical modifiers but if non-symbol key is used, no error occurs
All declarations of '[kBar]' must have identical modifiers
class foo1 { /** * @protected * @type { null | string } */ __bar = null; // <-- Ok get bar() { return this.__bar; } /** * @type { string } */ set bar(value) { this.__bar = value; } }
Symbol key behave same as string key
using exact same annotations on every symbol-property assigment allow avoid this error, but property type becomes any
any
const kBar = Symbol("bar"); class foo0 { /** * @protected * @type { null | string } */ [kBar] = null; // <-- Ok get bar() { return this[kBar]; } /** * @type { string } */ set bar(value) { /** * @protected * @type { null | string } */ this[kBar] = value; } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
π Search Terms
All declarations of '{property}' must have identical modifiers
JSDoc
Symbol
Property Modifiers
π Version & Regression Information
This is the behavior in every version I tried (4.X.X - 5.X.X)
β― Playground Link
https://www.typescriptlang.org/play/?ts=5.7.2&filetype=js#code/MYewdgzgLgBA1gIQIYCcYF4YGUCeBbAIxABsAKAIgNXIEoBuAKAeGKQghgDMQQAGGAN4MYImAHoAVBOGiYEmAAEADihBQApsA0ATGaPkKoOJesEwwAV2LEYAHxjQUASzABzGAF89IiWO8BtRFQAXQxzK2I6cTEYAB4AWniYAEFrGG1NVhQkKCdwDhBOGAByQOQUYOKYPAtoGAALJAA3UycMsFzgJBs8EG0nTid1FAgmWVd1WCoUUhpBb1kUSYsUMBgoeqcIMpDGWS9ZSWlZOUUjEzNHF3cD2V9vCEmYadIm7ot1OaET0Q2tnYqYTexA+e1EXi8zFY7C4PAAjPNDlIFgYVGpNDoUWdjKYBOE0vYrm5PCi-LIAPrk6ZhSzWKJiGIJJIAeTgY1EEymqFmiJ+MCWUBWaz+EAAdJTpmCRLcREcsYYcZcoM5iTKfGTRI8uTNgR8vgtfpsxRLUED3uopSSPEA
π» Code
π Actual behavior
All declarations of '[kBar]' must have identical modifiers
but if non-symbol key is used, no error occurs
π Expected behavior
Symbol key behave same as string key
Additional information about the issue
using exact same annotations on every symbol-property assigment allow avoid this error,
but property type becomes
any
The text was updated successfully, but these errors were encountered: