You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Code
The following code when compiled with "declaration": true:
/** * @module botbuilder-choices *//** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */constbreakingChars=" \n\r~`!@#$%^&*()-+={}|[]\\:\";'<>?,./";exportinterfaceToken{start: number;end: number;text: string;normalized: string;}exporttypeTokenizerFunction=(text: string,locale?: string)=>Token[];
Expected behavior:
Should generate a .d.ts file that looks like this:
/** * @module botbuilder-choices *//** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */exportinterfaceToken{start: number;end: number;text: string;normalized: string;}exportdeclaretypeTokenizerFunction=(text: string,locale?: string)=>Token[];
Actual behavior:
But instead it generates this with the comments stripped off:
If I simply change the code to this then it works fine:
/** * @module botbuilder-choices *//** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */exportinterfaceToken{start: number;end: number;text: string;normalized: string;}constbreakingChars=" \n\r~`!@#$%^&*()-+={}|[]\\:\";'<>?,./";exporttypeTokenizerFunction=(text: string,locale?: string)=>Token[];
The compiler will truncate the leading comments if the first construct in the file isn't exported. The same thing happens if you import a type from a module but that type isn't referenced by something you export.
The leading comments are needed by a TypeDoc plugin we're using and every time this happens what ever is in the file gets dropped from our documentation. I've been working around the issue by manually checking the generated .d.ts files for months and now other devs on our team are starting to accidentally break our docs.
I really need this fixed...
The text was updated successfully, but these errors were encountered:
For now, if you want to preserve the comment add a ! at the beginning. Comments at the beginning of the file with ! are considered copy-write comments and are always emitted..
Thanks... Everything is ok right now as we've just made sure that we properly order our imports. I was more worried about the long term need to constantly check the output. I'll close this for now,
TypeScript Version:
2.6.2
Search Terms:
truncate comments
Code
The following code when compiled with
"declaration": true
:Expected behavior:
Should generate a
.d.ts
file that looks like this:Actual behavior:
But instead it generates this with the comments stripped off:
If I simply change the code to this then it works fine:
The compiler will truncate the leading comments if the first construct in the file isn't exported. The same thing happens if you
import
a type from a module but that type isn't referenced by something youexport
.The leading comments are needed by a TypeDoc plugin we're using and every time this happens what ever is in the file gets dropped from our documentation. I've been working around the issue by manually checking the generated .d.ts files for months and now other devs on our team are starting to accidentally break our docs.
I really need this fixed...
The text was updated successfully, but these errors were encountered: