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

Rewrite on TS #29

Merged
merged 11 commits into from
Jan 25, 2023
Merged

Rewrite on TS #29

merged 11 commits into from
Jan 25, 2023

Conversation

nd0ut
Copy link
Contributor

@nd0ut nd0ut commented Jan 18, 2023

Fixes #28

  • Rewrite codebase with TypeScript
  • Saved compatibility: same API and bundle names
  • Use airbnb eslint config with prettier
  • To achieve typed notifications there are new exports added: defineNotificationComponent and createNotifier.
// notiwind.ts
import {
  createNotifier,
  NotificationGroup,
  defineNotificationComponent,
} from "notiwind";

export type NotificationSchema = {
  title: string;
  text: string;
};

export const notify = createNotifier<NotificationSchema>();
export const Notification = defineNotificationComponent<NotificationSchema>();
export { NotificationGroup };
<script setup lang="ts">
  import { notify, Notification, NotificationGroup } from "./notiwind.ts";

  notify({
    title: "title",
    text: "text",
  }, 4000);
</script>

<template>
<NotificationGroup>
  <Notification v-slot="{ notifications }">
   <!-- Here you have typed `notifications` -->
  </Notification>
</NotificationGroup>
</template>

@nd0ut nd0ut changed the title Ad typescript support Add typescript support Jan 18, 2023
@nd0ut nd0ut marked this pull request as ready for review January 23, 2023 17:00
@nd0ut
Copy link
Contributor Author

nd0ut commented Jan 23, 2023

Hey @emmanuelsw could you take a look on this?

@nd0ut nd0ut changed the title Add typescript support Rewrite on TS Jan 23, 2023
@emmanuelsw
Copy link
Owner

Hey! thank you so much for this, i had plans to add TS support and convert the project to a Vite library.
The implementation looks good, the only thing is that you included a package-lock.json but the project uses Yarn, so there is a yarn.lock file. Can you remove the package-lock.json and update the yarn.lock?

@nd0ut
Copy link
Contributor Author

nd0ut commented Jan 24, 2023

Can you remove the package-lock.json and update the yarn.lock?

done

@emmanuelsw emmanuelsw merged commit 63c9f81 into emmanuelsw:main Jan 25, 2023
@emmanuelsw
Copy link
Owner

Thank you again! I'm going to release this tomorrow.

This was referenced Jan 25, 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 this pull request may close these issues.

Add typescript support
2 participants