Skip to content

Commit 5965287

Browse files
committed
fix: ts type error while trying to set blade comments.
- Fixed ts type error `Type 'void | CharacterPair' is not assignable to type 'CharacterPair'` while trying to set blade comments in `setLanguageConfiguration` method. This probably happens because the `setBladeComments` method is returning void and being set directly to the lang config `blockComment` property which doesn't work. So to avoid this, we set the blade comments into a new variable instead and then only set the `blockComment` property if the conditional check of `bladeComments` variable is truthy, ie. has any value except null,undefined, etc.
1 parent f2504bc commit 5965287

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/configuration.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,12 @@ export class Configuration {
726726
* Get the user settings/configuration and set the blade or html comments accordingly.
727727
*/
728728
if (langId === "blade") {
729-
langConfig.comments.blockComment = this.setBladeComments(this.getConfigurationValue("bladeOverrideComments"), true);
729+
const bladeComments = this.setBladeComments(this.getConfigurationValue("bladeOverrideComments"), true);
730+
731+
// If bladeComments is has a value...
732+
if (bladeComments) {
733+
langConfig.comments.blockComment = bladeComments;
734+
}
730735
}
731736
}
732737

0 commit comments

Comments
 (0)