Skip to content

Commit

Permalink
Move interface definitions outside of <script setup>
Browse files Browse the repository at this point in the history
Putting them in separate <script> tags lets them be excluded from the
type definition for the component.

See the error when creating types (e.g. `pnpm vue-tsc --composite false
-p tsconfig.app.json --declaration --emitDeclarationOnly`; note that
this will generate *.d.ts files next to the source files), and this
comment:

<vuejs/language-tools#1232 (comment)>
  • Loading branch information
Matthew Klein committed Sep 16, 2022
1 parent 7054961 commit 0f0dbd1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 6 additions & 4 deletions src/components/SunriseSunset.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<script setup lang="ts">
import init, { getSunriseSunset } from "@sunrise-cli/pkg/sunrise_cli";
import { type PropType, computed } from "vue";
<script lang="ts">
interface Coord {
lat: number;
lon: number;
}
</script>

<script setup lang="ts">
import init, { getSunriseSunset } from "@sunrise-cli/pkg/sunrise_cli";
import { type PropType, computed } from "vue";
const props = defineProps({
coords: {
Expand Down
8 changes: 5 additions & 3 deletions src/components/variable-fonts/VariableFontAxis.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script setup lang="ts">
import type { PropType } from "vue";
<script lang="ts">
interface Opts {
id: string;
label: string;
Expand All @@ -11,6 +9,10 @@ interface Opts {
userStep: number;
default: number;
}
</script>

<script setup lang="ts">
import type { PropType } from "vue";
const props = defineProps({
modelValue: {
Expand Down

0 comments on commit 0f0dbd1

Please sign in to comment.