Skip to content

Typescript types? #774

Answered by gkiely
gkiely asked this question in General
Dec 8, 2023 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

Here's how I got this working locally for anyone interested:

Repo: https://github.com/gkiely/esm-project

Setup:

npm create vite@latest -- --template vanilla

jsconfig.json

{
  "compilerOptions": {
    "strict": true,
    "checkJs": true,
    "allowJs": true,
    "noEmit": true,
    "isolatedModules": true,
    "skipLibCheck": true,
  },
  "include": ["src/**/*.js", "main.d.ts"],
  "exclude": ["node_modules"],
}

src/main.js

import { useState } from 'https://esm.sh/preact/hooks';
import register from 'https://esm.sh/preact-custom-element';
import { html } from 'https://esm.sh/htm/preact';

const Counter = () => {
  const [count, setCount] = useState(0);

  return html`
    <div style="displa…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@ije
Comment options

@gkiely
Comment options

@ije
Comment options

Answer selected by gkiely
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants