Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix) better backwards compatibility #1640

Merged
merged 2 commits into from Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,112 @@
[
{
"range": {
"start": { "line": 12, "character": 19 },
"end": { "line": 12, "character": 20 }
},
"severity": 4,
"source": "ts",
"message": "Parameter 'e' implicitly has an 'any' type, but a better type may be inferred from usage.",
"code": 7044,
"tags": []
},
{
"range": {
"start": { "line": 21, "character": 19 },
"end": { "line": 21, "character": 20 }
},
"severity": 4,
"source": "ts",
"message": "Parameter 'e' implicitly has an 'any' type, but a better type may be inferred from usage.",
"code": 7044,
"tags": []
},
{
"range": {
"start": { "line": 11, "character": 5 },
"end": { "line": 11, "character": 12 }
},
"severity": 1,
"source": "ts",
"message": "Type '{ owntype: string; }' is not assignable to type 'HTMLProps<HTMLDivElement>'.\n Property 'owntype' does not exist on type 'HTMLProps<HTMLDivElement>'.",
"code": 2322,
"tags": []
},
{
"range": {
"start": { "line": 12, "character": 5 },
"end": { "line": 12, "character": 16 }
},
"severity": 1,
"source": "ts",
"message": "Type '{ onownclick: (e: any) => any; }' is not assignable to type 'HTMLProps<HTMLDivElement>'.\n Property 'onownclick' does not exist on type 'HTMLProps<HTMLDivElement>'. Did you mean 'onclick'?",
"code": 2322,
"tags": []
},
{
"range": {
"start": { "line": 19, "character": 5 },
"end": { "line": 19, "character": 12 }
},
"severity": 1,
"source": "ts",
"message": "Type '{ owntype: boolean; }' is not assignable to type 'HTMLProps<HTMLDivElement>'.\n Property 'owntype' does not exist on type 'HTMLProps<HTMLDivElement>'.",
"code": 2322,
"tags": []
},
{
"range": {
"start": { "line": 20, "character": 5 },
"end": { "line": 20, "character": 19 }
},
"severity": 1,
"source": "ts",
"message": "Type 'boolean' is not assignable to type 'string'.",
"code": 2322,
"tags": []
},
{
"range": {
"start": { "line": 21, "character": 5 },
"end": { "line": 21, "character": 16 }
},
"severity": 1,
"source": "ts",
"message": "Type '{ onownclick: (e: any) => any; }' is not assignable to type 'HTMLProps<HTMLDivElement>'.\n Property 'onownclick' does not exist on type 'HTMLProps<HTMLDivElement>'. Did you mean 'onclick'?",
"code": 2322,
"tags": []
},
{
"range": {
"start": { "line": 22, "character": 41 },
"end": { "line": 22, "character": 46 }
},
"severity": 1,
"source": "ts",
"message": "Property 'wrong' does not exist on type '{ foo: string; }'.",
"code": 2339,
"tags": []
},
{
"range": {
"start": { "line": 24, "character": 22 },
"end": { "line": 24, "character": 31 }
},
"severity": 1,
"source": "ts",
"message": "Type 'boolean' is not assignable to type 'string'.",
"code": 2322,
"tags": []
},
{
"range": {
"start": { "line": 25, "character": 22 },
"end": { "line": 25, "character": 32 }
},
"severity": 1,
"source": "ts",
"message": "Type '{ doesnexist: string; }' is not assignable to type '{ attribute?: string; }'.\n Property 'doesnexist' does not exist on type '{ attribute?: string; }'.",
"code": 2322,
"tags": []
}
]
@@ -0,0 +1,90 @@
[
{
"range": {
"start": { "line": 15, "character": 13 },
"end": { "line": 15, "character": 22 }
},
"severity": 1,
"source": "ts",
"message": "Type 'boolean' is not assignable to type 'string'.",
"code": 2322,
"tags": []
},
{
"range": {
"start": { "line": 16, "character": 13 },
"end": { "line": 16, "character": 30 }
},
"severity": 1,
"source": "ts",
"message": "Argument of type '{ doesnexist: string; }' is not assignable to parameter of type '{ attribute?: string; }'.\n Object literal may only specify known properties, and '\"doesnexist\"' does not exist in type '{ attribute?: string; }'.",
"code": 2345,
"tags": []
},
{
"range": {
"start": { "line": 19, "character": 5 },
"end": { "line": 19, "character": 12 }
},
"severity": 1,
"source": "ts",
"message": "Type 'boolean' is not assignable to type 'string'.",
"code": 2322,
"tags": []
},
{
"range": {
"start": { "line": 20, "character": 5 },
"end": { "line": 20, "character": 19 }
},
"severity": 1,
"source": "ts",
"message": "Type 'boolean' is not assignable to type 'string'.",
"code": 2322,
"tags": []
},
{
"range": {
"start": { "line": 21, "character": 34 },
"end": { "line": 21, "character": 39 }
},
"severity": 1,
"source": "ts",
"message": "Property 'wrong' does not exist on type '{ foo: string; }'.",
"code": 2339,
"tags": []
},
{
"range": {
"start": { "line": 22, "character": 41 },
"end": { "line": 22, "character": 46 }
},
"severity": 1,
"source": "ts",
"message": "Property 'wrong' does not exist on type '{ foo: string; }'.",
"code": 2339,
"tags": []
},
{
"range": {
"start": { "line": 24, "character": 22 },
"end": { "line": 24, "character": 31 }
},
"severity": 1,
"source": "ts",
"message": "Type 'boolean' is not assignable to type 'string'.",
"code": 2322,
"tags": []
},
{
"range": {
"start": { "line": 25, "character": 22 },
"end": { "line": 25, "character": 39 }
},
"severity": 1,
"source": "ts",
"message": "Argument of type '{ doesnexist: string; }' is not assignable to parameter of type '{ attribute?: string; }'.\n Object literal may only specify known properties, and '\"doesnexist\"' does not exist in type '{ attribute?: string; }'.",
"code": 2345,
"tags": []
}
]
@@ -0,0 +1,26 @@
<script lang="ts"></script>

<!-- valid for both -->
<div owntypefromold="foo" />
<div on:ownclickfromold={(e) => e.detail.foo} />

<own-element attribute="foo" />

<own-element-from-old attribute="foo" />

<!-- valid for new, invalid for old -->
<div owntype="foo" />
<div on:ownclick={(e) => e.detail.foo} />

<!-- valid for old, invalid for new -->
<own-element attribute={false} />
<own-element doesnexist="wrong" />

<!-- invalid -->
<div owntype={false} />
<div owntypefromold={false} />
<div on:ownclick={(e) => e.detail.wrong} />
<div on:ownclickfromold={(e) => e.detail.wrong} />

<own-element-from-old attribute={false} />
<own-element-from-old doesnexist="wrong" />
@@ -0,0 +1,24 @@
/* eslint-disable */
declare namespace svelte.JSX {
interface HTMLAttributes {
owntypefromold?: string;
onownclickfromold?: (event: CustomEvent<{ foo: string }>) => void;
}
interface IntrinsicElements {
'own-element-from-old': {
attribute?: string;
};
}
}

declare namespace svelteHTML {
interface HTMLAttributes {
owntype?: string;
'on:ownclick'?: (event: CustomEvent<{ foo: string }>) => void;
}
interface IntrinsicElements {
'own-element': {
attribute?: string;
};
}
}
@@ -0,0 +1,9 @@
{
"compilerOptions": {
/**
This is actually not needed, but makes the tests faster
because TS does not look up other types.
*/
"types": ["svelte"]
}
}
Expand Up @@ -3,15 +3,15 @@
"range": { "start": { "line": 9, "character": 5 }, "end": { "line": 9, "character": 19 } },
"severity": 1,
"source": "ts",
"message": "Argument of type '{ \"this-is\": string; }' is not assignable to parameter of type 'HTMLAttributes<...> & EventsWithColon<HTMLProps<HTMLDivElement>> & svelteHTML.HTMLAttributes<...>'.\n Object literal may only specify known properties, and '\"this-is\"' does not exist in type 'HTMLAttributes<...> & EventsWithColon<HTMLProps<HTMLDivElement>> & svelteHTML.HTMLAttributes<...>'.",
"message": "Argument of type '{ \"this-is\": string; }' is not assignable to parameter of type 'HTMLProps<\"div\", HTMLAttributes<any>>'.\n Object literal may only specify known properties, and '\"this-is\"' does not exist in type 'HTMLProps<\"div\", HTMLAttributes<any>>'.",
"code": 2345,
"tags": []
},
{
"range": { "start": { "line": 10, "character": 6 }, "end": { "line": 10, "character": 9 } },
"severity": 1,
"source": "ts",
"message": "Argument of type '{ bar: string; }' is not assignable to parameter of type 'HTMLAttributes<...> & EventsWithColon<HTMLProps<HTMLDivElement>> & svelteHTML.HTMLAttributes<...>'.\n Object literal may only specify known properties, and 'bar' does not exist in type 'HTMLAttributes<...> & EventsWithColon<HTMLProps<HTMLDivElement>> & svelteHTML.HTMLAttributes<...>'.",
"message": "Argument of type '{ bar: string; }' is not assignable to parameter of type 'HTMLProps<\"div\", HTMLAttributes<any>>'.\n Object literal may only specify known properties, and 'bar' does not exist in type 'HTMLProps<\"div\", HTMLAttributes<any>>'.",
"code": 2345,
"tags": []
}
Expand Down