Giter VIP home page Giter VIP logo

Comments (4)

endigo9740 avatar endigo9740 commented on August 28, 2024

I created a message regarding this issue on the Svelte Discord. I figured I'd shared here as well, just in case:
https://discord.com/channels/457912077277855764/1004975444459790356

Long story short, I need to know the best means to export custom Typescript interfaces as part of the package. Trying to do this in index.js, similar to a component, does not work. I figure there's a simple syntax to do so that I'm missing.

End goal is for end users to be able to import the type like this:

import type { DialogAlert } from '@brainandbones/skeleton';

Rather than having to point to the the full source like so:

import type { DialogAlert } from '@brainandbones/skeleton/Notifications/Stores';

I'll research and test a bit more soon, however, I welcome any support in the meantime!

from skeleton.

niktek avatar niktek commented on August 28, 2024

#72

The types have to be exported in a .ts file, doing this in src/lib/index.d.ts will block the autogenerated component exports that are created by svelte-kit package, so this is a quick little workaround to get custom types added to the root @brainandbones/skeleton namespace in the exported package

from skeleton.

endigo9740 avatar endigo9740 commented on August 28, 2024

This is great, looks like it'll do exactly what is needed, but I'll need to request a couple other small changes. I'll reject the PR and post comments there to make it obvious. Check there shortly.

from skeleton.

endigo9740 avatar endigo9740 commented on August 28, 2024

We appear to have a fix for this. See my latest comment here: #73

Long story short, we just need to rename index.js -> index.ts and then we can drop our Type exports right in! This should come alongside updates to the Dialog/Toast docs import snippets of course!

from skeleton.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.