chore: TS fixes cleanup (#14750)

* chore: TS fixes cleanup

- move a test
- revert seemginly unnecessary code changes

* add another test
pull/14758/head
Simon H 1 week ago committed by GitHub
parent 2bfdd1b436
commit 88a15cd706
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -698,16 +698,8 @@ export function analyze_component(root, source, options) {
} }
for (const node of analysis.module.ast.body) { for (const node of analysis.module.ast.body) {
if ( if (node.type === 'ExportNamedDeclaration' && node.specifiers !== null && node.source == null) {
node.type === 'ExportNamedDeclaration' &&
// @ts-expect-error
node.exportKind !== 'type' &&
node.specifiers !== null &&
node.source == null
) {
for (const specifier of node.specifiers) { for (const specifier of node.specifiers) {
// @ts-expect-error
if (specifier.exportKind === 'type') continue;
if (specifier.local.type !== 'Identifier') continue; if (specifier.local.type !== 'Identifier') continue;
const binding = analysis.module.scope.get(specifier.local.name); const binding = analysis.module.scope.get(specifier.local.name);

@ -433,13 +433,7 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) {
}, },
ImportDeclaration(node, { state }) { ImportDeclaration(node, { state }) {
// @ts-expect-error
if (node.importKind === 'type') return;
for (const specifier of node.specifiers) { for (const specifier of node.specifiers) {
// @ts-expect-error
if (specifier.importKind === 'type') continue;
state.scope.declare(specifier.local, 'normal', 'import', node); state.scope.declare(specifier.local, 'normal', 'import', node);
} }
}, },

@ -1,3 +0,0 @@
import { test } from '../../assert';
export default test({});

@ -1,5 +0,0 @@
<script lang="ts">
// TypeScript syntax should not cause compilation failure
interface MyInterface {}
class MyClass implements MyInterface {}
</script>

@ -8,6 +8,10 @@
console.log(this); console.log(this);
} }
function foo(): string {
return ""!;
}
class Foo<T> { class Foo<T> {
public name: string; public name: string;
x = 'x' as const; x = 'x' as const;
@ -16,6 +20,8 @@
} }
} }
class MyClass implements Hello {}
declare const declared_const: number; declare const declared_const: number;
declare function declared_fn(): void; declare function declared_fn(): void;
declare class declared_class { declare class declared_class {

Loading…
Cancel
Save