From fca5435605a233bc5b66aefdaa8496798b7c28ab Mon Sep 17 00:00:00 2001 From: mrkishi Date: Sun, 9 Jun 2019 17:04:07 -0300 Subject: [PATCH 1/2] add ambient type for generated svelte components --- src/runtime/ambient.ts | 19 +++++++++++++++++++ src/runtime/index.ts | 2 ++ 2 files changed, 21 insertions(+) create mode 100644 src/runtime/ambient.ts diff --git a/src/runtime/ambient.ts b/src/runtime/ambient.ts new file mode 100644 index 0000000000..b094056c59 --- /dev/null +++ b/src/runtime/ambient.ts @@ -0,0 +1,19 @@ +declare module '*.svelte' { + type Props = Record; + + export default class { + constructor(options: { + target: Element; + anchor?: Element; + props?: Props; + hydrate?: boolean; + intro?: boolean; + }); + + $set(props: Props): void; + $on(event: string, callback: (event: CustomEvent) => void): () => void; + $destroy(): void; + + [accessor: string]: any; + } +} diff --git a/src/runtime/index.ts b/src/runtime/index.ts index 40928da8a0..0973b93f1e 100644 --- a/src/runtime/index.ts +++ b/src/runtime/index.ts @@ -1,3 +1,5 @@ +import './ambient'; + export { onMount, onDestroy, From f82378e64f450123566337aad09efb459b5941c7 Mon Sep 17 00:00:00 2001 From: Richard Harris Date: Sun, 16 Jun 2019 14:40:52 -0400 Subject: [PATCH 2/2] whoops --- src/compiler/compile/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/compile/index.ts b/src/compiler/compile/index.ts index 63f9b5f610..30787f8d88 100644 --- a/src/compiler/compile/index.ts +++ b/src/compiler/compile/index.ts @@ -6,7 +6,7 @@ import render_ssr from './render-ssr/index'; import { CompileOptions, Warning } from '../interfaces'; import Component from './Component'; import fuzzymatch from '../utils/fuzzymatch'; -import { get_name_from_filename } from './utils/get_name_from_filename'; +import get_name_from_filename from './utils/get_name_from_filename'; const valid_options = [ 'format',