diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3139b0..5c58685 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: with: node-version: 14 - run: npm install - - run: npm install typescript@4.0.2 + - run: npm install typescript@4.5.0 - run: npm run tsc ts-current: diff --git a/package.json b/package.json index b76545e..21022ad 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ }, "homepage": "https://github.com/timocov/dts-bundle-generator", "dependencies": { - "typescript": ">=4.0.2", + "typescript": ">=4.5.0", "yargs": "^17.6.0" }, "devDependencies": { diff --git a/src/helpers/typescript.ts b/src/helpers/typescript.ts index fa82697..f42cca1 100644 --- a/src/helpers/typescript.ts +++ b/src/helpers/typescript.ts @@ -278,24 +278,13 @@ function getExportsForName( export type ModifiersMap = Record; -const modifiersPriority: Record = { +const modifiersPriority: Partial> = { [ts.SyntaxKind.ExportKeyword]: 4, [ts.SyntaxKind.DefaultKeyword]: 3, [ts.SyntaxKind.DeclareKeyword]: 2, [ts.SyntaxKind.AsyncKeyword]: 1, [ts.SyntaxKind.ConstKeyword]: 1, - - // we don't care about these modifiers as they are used in classes only and cannot be at the root level - [ts.SyntaxKind.AbstractKeyword]: 0, - [ts.SyntaxKind.ReadonlyKeyword]: 0, - [ts.SyntaxKind.StaticKeyword]: 0, - [ts.SyntaxKind.InKeyword]: 0, - [ts.SyntaxKind.OutKeyword]: 0, - [ts.SyntaxKind.OverrideKeyword]: 0, - [ts.SyntaxKind.PrivateKeyword]: 0, - [ts.SyntaxKind.ProtectedKeyword]: 0, - [ts.SyntaxKind.PublicKeyword]: 0, }; export function modifiersToMap(modifiers: (readonly ts.Modifier[]) | undefined | null): ModifiersMap {