According to the comments in discussion #576 the updateTag method actually allows for the undefined return type. This PR makes two simple changes:
It updates the TypeScript type definitions to match the behavior
It updates the docs to better describe the behavior and gives an output sample from the example code
Type
[ ] Bug Fix
[ ] Refactoring / Technology upgrade
[ ] New Feature
[x] Docs & TypeDefs update
Regarding the typedefs update
Currently returning undefined while using typescript will give this error
Type '(tagName: string, jPath: string, attrs: { [k: string]: string; }) => false | "A" | undefined' is not assignable to type '(tagName: string, jPath: string, attrs: { [k: string]: string; }) => string | boolean'.
Type 'false | "A" | undefined' is not assignable to type 'string | boolean'.
Type 'undefined' is not assignable to type 'string | boolean'.ts(2322)
The update the the typedefs will fix this and allow this to happen.
Regarding the docs update
A note about the example output in the docs that I added. This is the exact output when I tested it by running the code example given in the docs. It seems to say that"At": "Home" is added as an attribute on the A tag, but also "At": "Home" seems to be added as an element. This seems odd to me but I'm also somewhat new to FXP and I'm not sure if this is intended behavior or not. Regardless though, this is what the output is, and now the docs will give an example of that.
Regarding returning undefined
As far as I can tell when updateTag method has return undefined, it behaves exactly the same as return false. The docs and the typedefs now explicitly mention that.
Purpose / Goal
According to the comments in discussion #576 the
updateTag
method actually allows for theundefined
return type. This PR makes two simple changes:Type
Regarding the typedefs update
Currently returning
undefined
while using typescript will give this errorThe update the the typedefs will fix this and allow this to happen.
Regarding the docs update
A note about the example output in the docs that I added. This is the exact output when I tested it by running the code example given in the docs. It seems to say that
"At": "Home"
is added as an attribute on theA
tag, but also"At": "Home"
seems to be added as an element. This seems odd to me but I'm also somewhat new to FXP and I'm not sure if this is intended behavior or not. Regardless though, this is what the output is, and now the docs will give an example of that.Regarding returning
undefined
As far as I can tell when
updateTag
method hasreturn undefined
, it behaves exactly the same asreturn false
. The docs and the typedefs now explicitly mention that.