mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
73 lines
1.7 KiB
Plaintext
73 lines
1.7 KiB
Plaintext
index.d.ts(1,1): error TS1046: Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier.
|
|
|
|
|
|
==== index.d.cts (0 errors) ====
|
|
declare function foo(): void;
|
|
export = foo;
|
|
|
|
|
|
==== index.d.ts (1 errors) ====
|
|
namespace IllegalBecauseInstantiated {
|
|
~~~~~~~~~
|
|
!!! error TS1046: Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier.
|
|
export const m = 1;
|
|
}
|
|
|
|
namespace AlsoIllegalBecauseInstantiated {
|
|
class PrivateClass {
|
|
|
|
}
|
|
}
|
|
|
|
enum NotLegalEnum {
|
|
B = 1
|
|
}
|
|
|
|
import NoGoodAlias = NotLegalEnum.B;
|
|
|
|
const enum NotLegalConstEnum {
|
|
C = 2
|
|
}
|
|
|
|
// No errors after this point
|
|
class MyClassOk {
|
|
// Not a parameter property, ok
|
|
constructor(foo: string);
|
|
}
|
|
namespace NotInstantiated {
|
|
export interface JustAType { }
|
|
export type ATypeInANamespace = {};
|
|
}
|
|
declare namespace AmbientIsNotInstantiated {
|
|
export const stillOk = 12;
|
|
}
|
|
|
|
declare enum LegalEnum {
|
|
A = 1
|
|
}
|
|
|
|
declare namespace AmbientStuff {
|
|
namespace Nested {
|
|
export const stillOk = 12;
|
|
}
|
|
enum EnumInAmbientContext {
|
|
B = 1
|
|
}
|
|
|
|
import FineAlias = EnumInAmbientContext.B;
|
|
}
|
|
|
|
==== commonjs.d.cts (0 errors) ====
|
|
import foo = require("./other.cjs");
|
|
export = foo;
|
|
|
|
|
|
==== other.d.cts (0 errors) ====
|
|
declare function foo(): void;
|
|
export = foo;
|
|
|
|
|
|
==== esm.d.mts (0 errors) ====
|
|
declare const foo = 1234;
|
|
export default foo;
|
|
|