microsoft / microsoft/TypeScript
Behavior difference: (jsdoc) comment emit inconsistencies on expando functions
Personne n'a encore pris cette issue.
- Langage dominant
- Go
- Étoiles
- 111k
- Forks
- 14.3k
- Merge moyen
- 2 j 4 h
- PR mergées (30 j)
- 132
Description
Summary as below. Note that the commit emit fix for arrows will be a breaking change from TS 6.
tsc + .js |
tsc + .ts |
tsgo + .js |
tsgo + .ts |
|
|---|---|---|---|---|
| ExpandoFunctionInlineNamedExport | ✅ Comment | ✅ Comment | ✅ Comment | ✅ Comment |
| ExpandoArrowInlineNamedExport | ❌ Comment | ✅ Comment | ❌ Comment | ❌ Comment |
| ExpandoFunctionNamedExport | ✅ Comment | ✅ Comment | ✅ Comment | ✅ Comment |
| ExpandoArrowNamedExport | ✅ Comment | ✅ Comment | ❌ Comment | ❌ Comment |
| ExpandoFunctionDefaultExport | ✅ Comment | ✅ Comment | ✅ Comment | ✅ Comment |
| ExpandoArrowDefaultExport | ✅ Comment | ✅ Comment | ❌ Comment | ❌ Comment |
Steps to reproduce
- Start a plain new project
- "@typescript/native-preview": "7.0.0-dev.20260612.1",
- "typescript": "6.0.3"
- Run
npx tsgo --initto get the default tsconfig. Turn on these flags as well.- "allowJs": true,
- "checkJs": true,
- "stableTypeOrdering": true,
- "removeComments": false,
- Add the below files. Run
npx tsc&npx tsgoto see the difference.- Emitted type output from using
.jsand.tsare a bit different as shown above.
- Emitted type output from using
src/main.js
/**
* jsdoc description on `ExpandoFunctionInlineNamedExport`
*/
export function ExpandoFunctionInlineNamedExport() { return null; }
ExpandoFunctionInlineNamedExport.args = { num: 3 };
/**
* jsdoc description on `ExpandoArrowInlineNamedExport`
*/
export const ExpandoArrowInlineNamedExport = () => { return null; };
ExpandoArrowInlineNamedExport.args = { num: 3 };
/**
* jsdoc description on `ExpandoFunctionNamedExport`
*/
function ExpandoFunctionNamedExport() { return null; }
ExpandoFunctionNamedExport.args = { num: 3 };
/**
* jsdoc description on `ExpandoArrowNamedExport`
*/
const ExpandoArrowNamedExport = () => { return null; };
ExpandoArrowNamedExport.args = { num: 3 };
export { ExpandoFunctionNamedExport, ExpandoArrowNamedExport };
src/ExpandoFunctionDefaultExport.js
/**
* jsdoc description on `ExpandoFunctionDefaultExport`
*/
function ExpandoFunctionDefaultExport() { return null; }
ExpandoFunctionDefaultExport.args = { num: 3 };
export default ExpandoFunctionDefaultExport;
src/ExpandoArrowDefaultExport.js
/**
* jsdoc description on `ExpandoArrowDefaultExport`
*/
const ExpandoArrowDefaultExport = () => { return null; };
ExpandoArrowDefaultExport.args = { num: 3 };
export default ExpandoArrowDefaultExport;
Behavior with typescript@6.0
Output from using .js.
/**
* jsdoc description on `ExpandoFunctionInlineNamedExport`
*/
export function ExpandoFunctionInlineNamedExport(): null;
export namespace ExpandoFunctionInlineNamedExport {
namespace args {
let num: number;
}
}
export function ExpandoArrowInlineNamedExport(): null;
export namespace ExpandoArrowInlineNamedExport {
export namespace args_1 {
let num_1: number;
export { num_1 as num };
}
export { args_1 as args };
}
/**
* jsdoc description on `ExpandoFunctionNamedExport`
*/
export function ExpandoFunctionNamedExport(): null;
export namespace ExpandoFunctionNamedExport {
export namespace args_2 {
let num_2: number;
export { num_2 as num };
}
export { args_2 as args };
}
/**
* jsdoc description on `ExpandoArrowNamedExport`
*/
export function ExpandoArrowNamedExport(): null;
export namespace ExpandoArrowNamedExport {
export namespace args_3 {
let num_3: number;
export { num_3 as num };
}
export { args_3 as args };
}
//# sourceMappingURL=main.d.ts.map
export default ExpandoFunctionDefaultExport;
/**
* jsdoc description on `ExpandoFunctionDefaultExport`
*/
declare function ExpandoFunctionDefaultExport(): null;
declare namespace ExpandoFunctionDefaultExport {
namespace args {
let num: number;
}
}
//# sourceMappingURL=ExpandoFunctionDefaultExport.d.ts.map
export default ExpandoArrowDefaultExport;
/**
* jsdoc description on `ExpandoArrowDefaultExport`
*/
declare function ExpandoArrowDefaultExport(): null;
declare namespace ExpandoArrowDefaultExport {
namespace args {
let num: number;
}
}
//# sourceMappingURL=ExpandoArrowDefaultExport.d.ts.map
Behavior with tsgo
Output from using .js.
/**
* jsdoc description on `ExpandoFunctionInlineNamedExport`
*/
export declare function ExpandoFunctionInlineNamedExport(): null;
export declare namespace ExpandoFunctionInlineNamedExport {
var args: {
num: number;
};
}
export declare function ExpandoArrowInlineNamedExport(): null;
export declare namespace ExpandoArrowInlineNamedExport {
var args: {
num: number;
};
}
/**
* jsdoc description on `ExpandoFunctionNamedExport`
*/
declare function ExpandoFunctionNamedExport(): null;
declare namespace ExpandoFunctionNamedExport {
var args: {
num: number;
};
}
declare function ExpandoArrowNamedExport(): null;
declare namespace ExpandoArrowNamedExport {
var args: {
num: number;
};
}
export { ExpandoFunctionNamedExport, ExpandoArrowNamedExport };
//# sourceMappingURL=main.d.ts.map
/**
* jsdoc description on `ExpandoFunctionDefaultExport`
*/
declare function ExpandoFunctionDefaultExport(): null;
declare namespace ExpandoFunctionDefaultExport {
var args: {
num: number;
};
}
export default ExpandoFunctionDefaultExport;
//# sourceMappingURL=ExpandoFunctionDefaultExport.d.ts.map
declare function ExpandoArrowDefaultExport(): null;
declare namespace ExpandoArrowDefaultExport {
var args: {
num: number;
};
}
export default ExpandoArrowDefaultExport;
//# sourceMappingURL=ExpandoArrowDefaultExport.d.ts.map
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par les quatre fichiers source sous src/ et reproduisez la sortie des déclarations avec tsc et tsgo, en désactivant allowJs, checkJs, stableTypeOrdering et removeComments. Comparez l’émission de JSDoc pour les exports expando de function et arrow entre les exports nommés et default ; le travail est terminé lorsque les sorties suivent un comportement cohérent et convenu.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- go, javascript, typescript
- Domaine
- compilers
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- Calme
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100