Closed must closed 3 years ago
Couldn't reproduce. Steps that I followed:
export const getMessage = async (user: User, greetings?: string) => `${greetings || 'Hellow'} ${user.name}!`;
# on the server side code
tyfon b
tyfon s
# on the client side code
tyfon i
Signatures are updated instantly. Code works fine.
export const getMessage = async (user: User, greetings: string) => `${greetings || 'Hellow'} ${user.name}!`;
greetings
argument. Rebuilt and reran, re-installed SDK. Everything fine.@must Am I missing something?
So I figured that this works only if the client is restarted on my end after re-installing the SDK tyfon i
. If the client is kept running (even when running tyron i
on the side), it just results in the types not being updated.
well unless your client run-time reloads, there is no way for newly installed type definitions to be loaded. since the client-side runtime is independent of TyFON, this is not an issue with TyFON. I recommend configuring your client-side runtime so that it reloads on changes to node_modules/@api
(typically node_modules
is ignored by client runtimes such as webpack dev server).
Just for future reference. You can easily exclude the folder in the webpack config file:
module: {
rules: [
{
// ...
exclude: /node_modules\/(?!(\@api)\/).*/,
}
]
},
Just for future reference. You can easily exclude the folder in the webpack config file:
module: { rules: [ { // ... exclude: /node_modules\/(?!(\@api)\/).*/, } ] },
will add this to the docs, perfect (also would appreciate a PR adding this to the docs)
When updating the backend API's signature to make a property optional it can result in an error on the frontend where the SDK package is out of date (i.e. property not marked as optional) hence resulting in a typescript error.
Further testing is required.