Deploying TypeScript Type Definitions fo...
# package-development
m
I want to provide Typescript types and some base classes for people using my package. I've seen Matts approach here https://mattbrailsford.dev/deploying-typescript-type-definitions-for-umbraco-v14-packages but the approach that I'm using is more similar to the one in the core of Bellissima. Now. It works but IntelliSense in VS Code does not pick up my elements and only some of my types so I'm obviously doing something wrong. I think I have two questions: 1. Anyone that have and tips on guides/reading that I should look at? 2. Anyone that knows about any other package (open source) that exposes types and base classes as NPM package that I can have a look at for inspiration? Cheers!
k
uSync does it, (we have a custom menu type, https://github.com/KevinJump/uSync/blob/v15/dev/uSync.Backoffice.Management.Client/usync-assets/src/tree/types.ts) . the complete packages then use this to add themsselves to the uSync tree. e.g
Copy code
ts
const menuItem: UmbExtensionManifest = {
    type: 'usync-menuItem',
    alias: 'usync.menu.extensions',
    name: 'extensions',
    meta: {
        label: 'Extensions',
        icon: 'icon-brick',
        entityType: 'usync-menu-entry',
        menus: ['usync.menu'],
    },
};

export const manifests = [menuItem];
code seems to like this, we also export some components, and stuff, but really we just reference them in the html. we are not as nuanced as Matt's approach, we are exporting most everything, in the package json.
granted : that one doesn't do anything special.
m
Thanks for taking the time @Kevin Jump! It's kind of similar to what I do as well. I did fiddle with this yesterday and the key was to "export everything" 🙂 haha.. I think that some of the underlying types were not exported (I tried to clean up/only export what's needed) but it turned out that this was a bad idea. After trying to just export everything and don't try to clean up, VS Codes IntelliSense started to work. This kind of means that the public API surface is wider than what I would have liked it to be but it will be ok. In hindsight, it would have been smart of me to consider this from the beginning and organize the code accordingly. Thanks again!
4 Views