Skip to content

Commit

Permalink
refactor: colocate type in src/ (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
metonym committed Mar 15, 2024
1 parent dfa5718 commit 00f9fda
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 14 deletions.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"author": "Eric Liu (https://github.com/metonym)",
"svelte": "./src/index.js",
"main": "./src/index.js",
"types": "./types/index.d.ts",
"types": "./src/index.d.ts",
"scripts": {
"dev": "rollup -cw",
"test": "svelte-check --workspace=test"
Expand All @@ -33,7 +33,6 @@
"combo"
],
"files": [
"src",
"types"
"src"
]
}
5 changes: 1 addition & 4 deletions types/Keydown.svelte.d.ts → src/Keydown.svelte.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference types="svelte" />
import { SvelteComponentTyped } from "svelte";
import type { SvelteComponentTyped } from "svelte";

export interface KeydownProps {
/**
Expand All @@ -26,9 +25,7 @@ export default class Keydown extends SvelteComponentTyped<
{
combo: CustomEvent<string>;
key: CustomEvent<string>;
// @ts-expect-error
keyup: WindowEventMap["keyup"];
// @ts-expect-error
keydown: WindowEventMap["keydown"];
[key: string]: CustomEvent<any>;
},
Expand Down
File renamed without changes.
4 changes: 1 addition & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import Keydown from "./Keydown.svelte";

export default Keydown;
export { default } from "./Keydown.svelte";
6 changes: 2 additions & 4 deletions test/Keydown.test.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<script lang="ts">
import Keydown from "../types";
import K from "../types/Keydown.svelte";
import Keydown from "../src";
import K from "../src/Keydown.svelte";
let showModal = true;
</script>

<!-- svelte-ignore missing-declaration -->
<Keydown
pauseOnInput
paused={!showModal}
Expand All @@ -17,5 +16,4 @@
}}
/>

<!-- svelte-ignore missing-declaration -->
<K on:combo={(e) => e.detail} />

0 comments on commit 00f9fda

Please sign in to comment.