-
Notifications
You must be signed in to change notification settings - Fork 115
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
Finish converting to TypeScript #611
Draft
webwarrior-ws
wants to merge
22
commits into
lnp2pBot:main
Choose a base branch
from
webwarrior-ws:convert-to-ts-final
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Convert bot/modules/community module to TypeScript.
Convert bot/modules/disputemodule to TypeScript.
Convert bot/modules/eventsmodule to TypeScript.
Convert bot/modules/language to TypeScript.
Convert bot/modules/nostr to TypeScript. Specified "lib" property in tsconfig.json because otherwise TypeScript compiler complains about usage of `Promise.any` in bot/modules/nostr/index.ts: ``` Property 'any' does not exist on type 'PromiseConstructor'. Do you need to change your target library? Try changing the lib compiler option to 'es2021' or later. ```
Convert bot/modules/user to TypeScript.
Convert bot/middleware to TypeScript.
Convert bot module (except bot/modules/orders) to TypeScript. Had to make several changes to IOrder model to allow some fields to have null or undefined value, as there is code that assigns these values. Also changed signature of several functions in bot/messages.ts so that `bot` argument now has `MainContext` type instead of `Telegraf<MainContext>`, because that's what gets passed by code calling those functions.
Introduced HasTelegram type for use in functions that have `bot` argument, which can be either `Context` or `Telegraf<Context>`, but only `telegram` property is used.
Convert bot/modules/orders module to TypeScript.
Converted requires to imports where applicable and fixed type errors resulting from it.
Convert ln module to TypeScript.
Add type packages needed for Typescript code to package.json.
Setup eslint so that it checks .ts files instead of .js.
Fix "Import in body of module; reorder to top import/first" eslint errors.
From Promise<void> to Promise<undefined>, to get rid of the following error: ``` tests/bot/validation.spec.ts(376,19): error TS2339: Property 'tg_id' does not exist on type 'void | (UserDocument & { _id: ObjectId; })'. Property 'tg_id' does not exist on type 'void'. ```
Silenced remaining eslint errors as what they refer to is intended behavior.
Like it was before 4b278ce.
By adding guards for values that can be null/undefined.
Because all code is now converted to TS.
Hi @webwarrior-ws this is a great contribution, but please remember to split it on smaller PR for a easier review 😃 |
One more PR: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Convert all remaining JavaScript code to TypeScript.