I am getting a TS7016 'Could not find a declaration file for module '../composables/httpResponses'. '/Users/username/project/src/composables/httpResponses.js' implicitly has an 'any' type.' when I try to import an array from a local .js file into my view component. Here's the structure:
httpResponses.js
export const httpResponses = [
{
"code": 301,
"message": "Moved Permanently",
},
{
"code": 401,
"message": "Unauthorized",
}
]
interface.ts
export interface HttpResponse {
code: number;
message: string;
description: string;
}
App.vue
<template>
<h1>testing</h1>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { httpResponses } from './httpResponses';
import { HttpResponse } from './interface'
export default defineComponent({
name: 'App',
data() {
return {
matchingResponse: undefined as HttpResponse | undefined
}
},
mounted() {
this.matchingResponse = httpResponses.find(response =>
response.code === 401)
}
})
</script>
What am I doing wrong? How is this supposed to be done? I searched the web and the Vue 3 docs and all I'm finding is that this usually happens to people incorporating 3rd party packages, but this isn't a package.
The actual project can be found here and I tried to create a minimum reproducible code sandbox here but failed (I don't think they offer a Vue3/TS boilerplate).