Open coolaj86 opened 3 years ago
There's an alternate syntax that works:
/**
* @typedef {{
* "Emp#": string,
* "First Name": string,
* }} EmpCsv
*/
And the .d.ts counterpart should look like this:
interface EmployeeCsv {
"Emp#": string,
"First Name": string,
}
Is there a way to add descriptions to a member with this alternate style? I cannot get vscode to be happy with any variation I attempt
/**
* @typedef {{
* "Emp#": string, // want to give context to Emp# here
* "First Name": string,
* }} EmpCsv
*/
I tried a couple of workarounds to no avail. Is there any functioning syntax where we can add normal, full-fledged annotation with description to a special character field name?
Edit: The best I've done so far is doing the jankiness below for the special character fields.
/**
* @typedef FooHelperProps
* @property {string} fooField - Can still annotate regular fields at least
*
*/
/**
* @typedef {FooHelperProps & {":specialField": any[]}} FooProps // Can't annotate ":specialField"
*/
You'd never put
#
as an object name for a sane reason... but sometimes you have to deal with CSV. According to the JSDoc docs, it seems like this should do the job:But I get errors...
Asked at https://stackoverflow.com/questions/68946492/how-can-i-escape-special-characters-names-in-jsdoc-typescript.