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

[Question] How does this work? #20

Open
danimesq opened this issue Jan 3, 2023 · 4 comments
Open

[Question] How does this work? #20

danimesq opened this issue Jan 3, 2023 · 4 comments

Comments

@danimesq
Copy link

danimesq commented Jan 3, 2023

Does this enables spices to be written in TypeScript while being read by CJS as normal Javascript?

@danimesq
Copy link
Author

danimesq commented Jan 3, 2023

Are this a framework for developing spices or an extension for Cinnamon itself?

@Gr3q
Copy link
Owner

Gr3q commented Jan 3, 2023

For the first question, yes if you transpile to JS.

For the second question, this just enables development of spices using Typescript. More specifically it provides typescript declarations for libraries that are provided out of the box for spices in CJS under imports.*.

@danimesq
Copy link
Author

danimesq commented Jan 3, 2023

So, spices' devs could write the "frontend" in vanilla CJS while imports.*'ing most of the code (the "backend" - quotes with an extra grain of salt pls) in TS + types-cjs declarations?

@Gr3q
Copy link
Owner

Gr3q commented Jan 3, 2023

You don't need this library for vanilla (C)JS. You can also write an applet/extension in TS without it with a dummy declaration like this:

declare global {
    const imports: any;
}

but obviously it has some drawbacks.

So this library is only for providing declarations for that namespace for correct type-checking for Typescript.

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

No branches or pull requests

2 participants