Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript compatibility #2

Closed
st-- opened this issue Jun 8, 2021 · 2 comments · Fixed by #10
Closed

TypeScript compatibility #2

st-- opened this issue Jun 8, 2021 · 2 comments · Fixed by #10

Comments

@st--
Copy link
Collaborator

st-- commented Jun 8, 2021

I'm using this component in a TypeScript-based app. When running npx svelte-check, I get the following TypeScript compiler error:

src/App.svelte:26:35
Error: Cannot find module 'svelte-collapsible' or its corresponding type declarations. (ts)
  import { CollapsibleCard } from "svelte-collapsible";

I believe this could be fixed by exporting types. My initial search regarding what changes would be required came up with sveltejs/component-template#29 and this linked typed template: https://github.com/mattjennings/svelte-typescript-component-template (which ensures it can be consumed by both typescript and plain javascript apps) - would you be willing to make the corresponding changes to your component package?

@rsdavis
Copy link
Owner

rsdavis commented Jun 8, 2021

I have never used TypeScript so I'm not familiar with it. But I will accept a PR :)

@Alfagun74
Copy link

just declare a module in your types folder

svelte-collapsible.d.ts

declare module "svelte-collapsible";

@st-- st-- mentioned this issue Apr 12, 2023
@st-- st-- closed this as completed in #10 May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants