Typescript support?
See original GitHub issueI’m using nuxt with typescript (nuxt-property-decorator), when import svg:
<script lang="ts">
import { Component, Vue } from 'nuxt-property-decorator'
import Logo from '@/assets/svg/logo.svg'
@Component({
components: {
Logo
}
})
class Def extends Vue {}
export default Def
</script>
I’m getting error: Cannot find module '@/assets/svg/logo.svg'.Vetur(2307)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:12 (1 by maintainers)
Top Results From Across the Web
TypeScript: JavaScript With Syntax For Types.
TypeScript extends JavaScript by adding types to the language. TypeScript speeds up your development experience by catching errors and providing fixes ...
Read more >TypeScript - Wikipedia
TypeScript supports definition files that can contain type information of existing JavaScript libraries, much like C++ header files can describe the ...
Read more >TypeScript Programming with Visual Studio Code
Visual Studio Code includes TypeScript language support but does not include the TypeScript compiler, tsc . You will need to install the TypeScript...
Read more >TypeScript | WebStorm Documentation - JetBrains
WebStorm supports developing, running, and debugging TypeScript source code. ... Learn more from Compiling TypeScript into JavaScript.
Read more >TypeScript support in Svelte - Learn web development
First-class TypeScript support has been Svelte's most requested feature for quite some time. Thanks to the hard work of the Svelte team, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@manniL Yes I have !
@webcoderkz You need a file in root directory or in a
@types
directory (in both cases TypeScript compiler will take it into account).It needs to be a
.d.ts
file (example:svg-shims.d.ts
)With content :
It makes TypeScript aware of what type should resolve a SVG file, fixing errors when importing
.svg
in TypeScript files.PS : I will add a note in new TypeScript docs about non-TS/JS imports
@webcoderkz You have to declare the
svg?inline
in the declaration file as well:It works fine for me 😃