Prefabs
Last updated
Last updated
Prefabs are piece of a model definition you can re-use across your model/apps. CushyStudio comes with a lot of prefabs, and lots of utilities to create new prefabs.
library/built-in/_prefabs/prefab_model.ts
this is a picture of the model prefab available in cushy studio.
When you just want to have the exact same fields as you can find in a
You can use
to make your prefabs very fast to typecheck, you can:
export a named type alias for your prefab return type
annotate the return of your prefab function with that type
since 2024-06-25, there is now a globally available X
namespace that allow to quickly add typings to your prefabs without having to import anything
first, install the vscode extension
Young-Vform.copy-hover-type
then, you can copy the type of a variable by hovering over it and pressing the proper keybinding (ctrl+k ctrl+h
on windows by default)
typescript will bail-out and show ...
if the type is too long to be displayed. sadly, the extension mentioned above will not be able to expand those ...
and typescript codebase do not have any option to change that. (some people will mention using noErrorTruncation
, but it doesn't work for this use-case, since we do not have any error here, just a truncation of the type given by the Language Server)
https://stackoverflow.com/questions/53113031/how-to-see-a-fully-expanded-typescript-type-without-n-more-and
you need to edit the tsserver.js
file your vscode instance is using
e.g. for mac
and update the defaultMaximumTruncationLength
from 160
to some higher value (e.g. 4000
)
CushyStudio comes with some advanced typescript tooling to debug inference speed issues, and help to troubleshoot code slowness.
to start the tool, you just need to:
uncomment those two lines in your .vscode/settings.json
start the tool with the command