TypeStrong / ts-loader

TypeScript loader for webpack
https://johnnyreilly.com/ts-loader-goes-webpack-5
MIT License
3.44k stars 429 forks source link

webpack 5 + Vue + TS-Loader how to use generics? #1620

Open Anubarak opened 12 months ago

Anubarak commented 12 months ago

I tried to use generics with webpack and while I have no problems in my current Vite project I have no clue how to make it working with webpack.

I always receive TS2304: Cannot find name 'T'. For example

<script setup lang="ts" generic="T extends string">
interface Props {
  modelValue: T;
}
const props = defineProps<Props>();
</script>

<template>{{ modelValue }}</template>

Is there a way to enable generics with this TS Loader and webpack 5? I created a minimal repo here https://codesandbox.io/p/sandbox/webpack-vue-3-forked-p67wfr?welcome=true

Expected Behaviour

Actual Behaviour

Steps to Reproduce the Problem

Location of a Minimal Repository that Demonstrates the Issue.

https://codesandbox.io/p/sandbox/webpack-vue-3-forked-p67wfr?welcome=true

Anubarak commented 7 months ago

So I guess this is not possible?