Skip to content

Commit

Permalink
fix(TypeScript): imports not working in TypeScript
Browse files Browse the repository at this point in the history
While the node.js exports work perfectly fine, TypeScript doesn't parse those.
As such, TS users would get an error when importing the module.
Alongside that, this commit fixes eslint for mjs files,
which need @babel to process TLA
  • Loading branch information
vladfrangu committed Apr 12, 2021
1 parent 75f902b commit 4738c33
Show file tree
Hide file tree
Showing 19 changed files with 932 additions and 48 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": ["@babel/plugin-syntax-top-level-await"]
}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ globals.*map
globals.d.ts
globals.mjs

v*.js
v*.*map
v*.d.ts
v*.mjs

gateway/**/*.js
gateway/**/*.map
gateway/**/*.d.ts
Expand Down
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ audit=false
fund=false
legacy-peer-deps=true
tag-version-prefix=""
message="chore(release): %s :tada:"
message="chore(release): %s 🎉"
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,21 @@ We also provide typings compatible with the [deno](https://deno.land/) runtime.

```ts
// Importing a specific API version
import { APIUser } from 'https://raw.githubusercontent.com/discordjs/discord-api-types/main/deno/shortcuts/v8/mod.ts';
import { APIUser } from 'https://raw.githubusercontent.com/discordjs/discord-api-types/main/deno/v8.ts';
```

2. From [deno.land/x](https://deno.land/x)

```ts
// Importing a specific API version
import { APIUser } from 'https://deno.land/x/discord_api_types/shortcuts/v8.ts';
import { APIUser } from 'https://deno.land/x/discord_api_types/v8.ts';
```

3. From [skypack.dev](https://www.skypack.dev/)

```ts
// Importing a specific API version
import { APIUser } from 'https://cdn.skypack.dev/discord-api-types/shortcuts/v8?dts';
import { APIUser } from 'https://cdn.skypack.dev/discord-api-types/v8?dts';
```

## Project Structure
Expand Down
6 changes: 3 additions & 3 deletions deno/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,21 @@ We also provide typings compatible with the [deno](https://deno.land/) runtime.

```ts
// Importing a specific API version
import { APIUser } from 'https://raw.githubusercontent.com/discordjs/discord-api-types/main/deno/shortcuts/v8/mod.ts';
import { APIUser } from 'https://raw.githubusercontent.com/discordjs/discord-api-types/main/deno/v8.ts';
```

2. From [deno.land/x](https://deno.land/x)

```ts
// Importing a specific API version
import { APIUser } from 'https://deno.land/x/discord_api_types/shortcuts/v8.ts';
import { APIUser } from 'https://deno.land/x/discord_api_types/v8.ts';
```

3. From [skypack.dev](https://www.skypack.dev/)

```ts
// Importing a specific API version
import { APIUser } from 'https://cdn.skypack.dev/discord-api-types/shortcuts/v8?dts';
import { APIUser } from 'https://cdn.skypack.dev/discord-api-types/v8?dts';
```

## Project Structure
Expand Down
4 changes: 0 additions & 4 deletions deno/shortcuts/v6.ts

This file was deleted.

6 changes: 0 additions & 6 deletions deno/shortcuts/v8.ts

This file was deleted.

4 changes: 4 additions & 0 deletions deno/v6.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './globals.ts';
export * from './gateway/v6.ts';
export * from './payloads/v6/mod.ts';
export * from './rest/v6/mod.ts';
6 changes: 6 additions & 0 deletions deno/v8.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export * from './globals.ts';
export * from './gateway/v8.ts';
export * from './payloads/v8/mod.ts';
export * from './rest/v8/mod.ts';
export * from './rpc/v8.ts';
export * as Utils from './utils/v8.ts';
Loading

0 comments on commit 4738c33

Please sign in to comment.