will accept arbitrary keyword arguments. That may not be desired, since mistyping a keyword arg could silently fail, as you noted (i.e. the function would accept it, but fail to alert the user that the kwarg was incorrect, and the kwarg would not act as the user intended).
That behavior might be necessary for functions which might pass on kwargs to callbacks, etc., but the common way to define optional kwargs is to set the default value for the keyword arg to nothing, and then check for it in the function body:
function testkwargs(; width=nothing)
if !isnothing(width)
...
@halleysfifthinc thanks for sharing this perspective. Indeed, unless functions pass on kwargs to callbacks etc. it is a good practice to set each kwarg to nothing to enable dispatching mechanism to check on each associated keyword. The code quality goes up, I like that .