Skip to content

Conversation

@stof
Copy link
Member

@stof stof commented Sep 5, 2024

This will allow type-checking the codebase, by fixing cases where the typescript inference is not sufficient without a hint.

This helps with type-checking the codebase
const cache = {};

cache.type = 'filesystem';
cache.type = /** @type {const} */ ('filesystem');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this syntax with /** @type */ followed by a parenthesized expression as the JSDoc syntax for a cast.
Using const as type allows to do the same than as const in typescript

@stof stof requested a review from Kocal September 5, 2024 10:16
@stof stof merged commit 1d49c5d into symfony:main Sep 6, 2024
@stof stof deleted the add_internal_types branch September 6, 2024 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants