This issue occurs when the variable level
is initialized with the value 'undefined'.
Although this code functions correctly in JavaScript, it encounters problems when using TypeScript.
interface Find {
level?: string;
}
let find: Find = {};
if (!!level) {
find.level = level;
}
The final value of the object 'find' will be:
{"level":"undefined"}
Instead of just:
{}