mirror of
https://github.com/luau-lang/luau.git
synced 2025-04-07 20:30:53 +01:00
Added assert
call alternative
This commit is contained in:
parent
560ffd520f
commit
bf1236e58b
1 changed files with 7 additions and 0 deletions
|
@ -81,3 +81,10 @@ It might be useful to warn about unnecessary uses of this operator when the valu
|
|||
### Bad practice
|
||||
|
||||
The operator might be placed by users to ignore/silence correct warnings and lower the strength of type checking that Luau provides.
|
||||
|
||||
## Alternatives
|
||||
|
||||
Aside from type assertion operator `::` it should be possible to place `assert` function calls before the operation.
|
||||
Type refinement/constraints should handle that statement and avoid warning in the following expressions.
|
||||
|
||||
But `assert` call will introduce runtime overhead without adding extra safety to the case when the type is nil at run time, in both cases an error will be thrown.
|
||||
|
|
Loading…
Add table
Reference in a new issue