* refactor(bot)!: setup desired properties for all transformers
SetupDesiredProps when is given an object that does not corrispond to a transformer object that supports desired properties will behave like TransformProperty on the entire object as when it tries to get the properties for said object it will find `never` as the props and for `IsKeyDesired` a props of `never` means that all props are desired.
* Use Equals helper, clean up a bit the code
* Explicit the IsKeyDesired TProps never behavior
* Add all trasformer objects to bot.transformers.$inferredTypes
I prefer semicolors, they also help avoiding certain pitfalls in JavaScript/TypeScript, such as the following code sample:
```js
const xyz = "test"
(something.else as string) = "another"
```
This results in a TypeError: "test" is not a function, this is because js thinks we are trying to call the string "test" as a function.
To fix this it requires a `;` somewhere before the `(`, such as `;(something ... ` which in my opinion is ugly and less clean overall.
Updated desiredProperties in transformers to be generic so that it can be used to retrive the bot desired properties, and removed the option from `CreateBotOptions.transformers.desiredProperties` as that would cause the typings for the bot to be incorrect
Co-authored-by: Awesome Stickz <awesome@stickz.dev>
* feat(types,bot): Add Label component and new modal stuff
Since now there are some fields that are only in responses the types got a bit more complicated
* Add char limits to label label & desc
* update comments
* fix format
* Move Require to shared.ts
* code review
---------
Co-authored-by: Awesome Stickz <awesome@stickz.dev>
* refactor(transformers)!: Use type helper to define customizers
This allows us to ensure that customizers always follow the correct types for the transformers and we don't have 2 places to add the types.
* remove outdated comment in transformInteractionDataResolved
* remove not needed cast
* remove not needed cast
Currently we import from `index.js` files where we could simply import the actual file(s) or module we need.
This also creates a bit of confusion since it isn't obvious from where stuff is coming from, especially when we are importing types such as `Discord<XYZ>` types both from `@discordeno/types` and a `index.js` in the same file, one such example is `transformers/reverse/component.ts`.
As far as I can tell, this does not have any specific advantage beside readability, maybe something with tree-shaking. (and for us, tree-shaking doesn't really matter)
The only files that still import index.js files are:
- index.js files themself
- bot/src/handlers.js since it does a `import * as handlers from './handlers/index.js'` and the alternative is like 90 lines of imports
Co-authored-by: Link <link20050703@gmail.com>
They exited in the types but didn't in the runtime object causing a runtime error when the code needed to transform a nameplate
Co-authored-by: Awesome Stickz <awesome@stickz.dev>
* Add lobby support
* Fix CI
Apparently for extends a bot was a LobbyMember since both had
a required id property and even if LobbyMember had other properties
as well that did not matter
* update LobbyMember flags to use ToggleBitfield
* feat: add missing params to getThreadMember() and getThreadMembers()
* add member property from payload in threadMember transformer
* mark guildId as BigString | undefined and pass undefined in threadMember transformer
* fix type of after, limit params of ListThreadMembers
* add tsdoc for GetThreadMember and GetGuildAuditLog
* make options param of getThreadMember() and getThreadMembers() optional
---------
Co-authored-by: Fleny <Fleny113@outlook.com>
* Remove TBot, Use SetupDesiredProps
* Remove even more clutter from intellisense
* Use type instead of interfaces for some types
This avoids the need for mapped types in Bot
* docs: add info about removing ts clutter to desired props guide
* docs: improve ts clutter section in desired props guide more
---------
Co-authored-by: Awesome Stickz <awesome@stickz.dev>
* Add type helpers for typeLevel based desired props
This also fixes / added a few stuff that was missing in exiting
types & transformers, however due to this a few transformers got a
breaking change due to the need to pass down the shardId
* Fix benchmark type error
* Add the generics to createBot / Bot / ..
This caused a lot of breaking changed due to the required generics on a
bunch of types
* Fix benchmark type error?
* Fix benchmarks type error
* Fix E2E test type error
* remove defaultDesiredPropertiesValue
* Remove `internal` jsdoc from CompleteDesiredProprieties
* Add tests for createDesiredPropertiesObject
* Fix interaction.bot type
* Remove Capitalize type helper
It is already built-in into typescript as an intrinsic
* Fix typo
* Update message on missing desired properties
* Fix CI
* Move infer types to 'transformers.$inferredTypes'
* Fix CI
* Fix CI, again
* Use GatewayHandlers in params of create function
* change default behavior to remove key
* Fix CI
* fix types for e2e test
* Move transformers types to a single file
* Add script to test TS Compiler api capabilities
Remove nested objects where possible
* Use Partial<Role> and DiscordOverwrite instead of objects in AuditLogChange
* Fix typescript errors
* Remove interfaces.json
It is a generated file from the test script, not something that should be commited
* Start work on the test generation script
The TS version got bumped to 5.5.3
* Fix any type, use node16 module resolution
"node" is a deprecated alias for "node10", node16 is the recommended
Add code to check for type errors when getting the types from the interfaces
Fix errors when TS tries to find the files that the root tsconfig.json handles
* remove some useless compile options in TSApiTest
* Add jsdoc parsing
JSDoc tags with the next right after are not supported
* fix small format issue
* Fix ApplicationCommandPermissions todo
* Fix CI error
* Simplify parseDocumentation
* get type directly from the sourceFile
* remove hasUndefinedUnion as it is no longer used
* fix discordeno bin file name
* Update the yarn lockfile
* Merge scripts into one
* Use `@internal` instead of `@private` + `@deprecated`
* work on .d.ts files
* Process interface members once
* Move emit/preEmit diagnostics to a unit test
they can take quite a while, even 3-4 seconds, so running in the CLI every time does not seem ideal
* test: add build:types to test:unit dependencies
This is a test commit, it will provably get reversed. The scope is to see what CI does with this
* add find-up to deno import map
* add typescript to the deno import map
* Add node:assert to deno import map
* check for this.timeout that exists
deno does not have the timeout
* add build:type to deno-unit
* Temp hack to work-around the script deno tests
* Test with bun running the test as well
* fix turbo deps for unit tests
* remove test scripts
* Update CI to use build:type cache
* Apply code review suggestion
Co-authored-by: LTS20050703 <lts20050703@gmail.com>
* Add code to modify the interface member
* use an actual config
The config source is still a dummy object for now
* Search and use discordeno.config.js file
* provide config from cli options
* Handle props in base objects
The dependencies of an object need to be declared/updated manually, it would be painful to fix this in such a way that would be something that Typescript can give us from the compiler API
* add some tests for desired proprieties
* also check for a .mjs config file
* Add support for .ts config files
We use the typescript compiler to emit an in-memory version of the config file, import it and then remove it. It does not do bundling so if the config imports local files it will not work. Also the file is not type-checked as it would slow down the config loading
* remove compiler host, use callback on program.emit
* fix deno ci error
* add node:fs/promises to deno import map
---------
Co-authored-by: LTS20050703 <lts20050703@gmail.com>
* Add flags field to ModifyGuildMember
Also add the GuildMemberFlags enum as that was missing
* Add flags to member object
* Fix type error
* Update member transformer
* Readd flags desired propriety
* Rename enum to MemberFlag for consitency
* Rename to GuildMemberFlags, use number not the enum itself
* Use ToggleBitfield for flags
* Add getters
* Fix build error
* Merge flags in toggles
* change flags getter to return the actual flags
And not our custom toggles values
* Fix reverse transformer
* Migrate eslint and prettier to biomejs
This does NOT include examples/bigbot as it has its own formatter
* Update to biome 1.8.0
* Readd dotenv dev dependency to rest
During a merge it got lost