-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See [CHANGELOG](https://github.com/aws/jsii/blob/bump/1.85.0/CHANGELOG.md)
- Loading branch information
Showing
40 changed files
with
975 additions
and
1,173 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
name: Docker Images | ||
|
||
on: | ||
merge_group: {} | ||
pull_request: | ||
branches: [main, release] | ||
push: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
name: GitHub Pages | ||
|
||
on: | ||
merge_group: {} | ||
pull_request: | ||
branches: [main] | ||
push: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: HandleStaleDiscussions | ||
on: | ||
schedule: | ||
- cron: '0 */4 * * *' | ||
discussion_comment: | ||
types: [created] | ||
|
||
jobs: | ||
handle-stale-discussions: | ||
name: Handle stale discussions | ||
runs-on: ubuntu-latest | ||
permissions: | ||
discussions: write | ||
steps: | ||
- name: Stale discussions action | ||
uses: aws-github-ops/handle-stale-discussions@v1 | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
name: Main | ||
|
||
on: | ||
merge_group: {} | ||
pull_request: | ||
branches: [main, release] | ||
push: | ||
|
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
name: pull-request-lint | ||
on: | ||
merge_group: {} | ||
pull_request_target: | ||
types: | ||
- labeled | ||
|
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,6 @@ nav: | |
- index.md | ||
- quick-start | ||
- typescript-restrictions.md | ||
- configuration | ||
- hints.md | ||
- configuration | ||
- toolchain |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,14 +160,36 @@ export class Child extends Base { | |
} | ||
``` | ||
|
||
## Parameterized Types (aka: Generics) | ||
## Index Signatures | ||
|
||
Parameterized types are not consistently supported in all supported target languages. **Go** does not currently support | ||
generics, and the differences in generic semantics between **TypeScript**, **C#** and **Java** make it difficult to | ||
correctly represent such types in all those languages. As a consequence, `jsii` does not support declaring parameterized | ||
types. | ||
**TypeScript** allows declaring _additional properties_ through the use of index signatures. These are however not | ||
supported by the _jsii type system_ and are rejected by the compiler. | ||
|
||
Only certain *built-in* parameterized types can be used in `jsii` modules: | ||
!!! info | ||
Version `1.x` of the compiler _silently ignores_ index signatures instead of reporting a compilation error. Users | ||
with offending APIs migrating from `[email protected]` to `[email protected]` or newer need to either remove those declarations, or | ||
explicitly ignore them using the [`@jsii ignore` tag](./hints.md#excluding-a-declaration-from-multi-language-support). | ||
|
||
```ts hl_lines="4-5" | ||
export interface WithIndexSignature { | ||
public readonly name: string; | ||
|
||
// 💥 Index signatures are not supported | ||
public [key: string]: unknown; | ||
} | ||
``` | ||
|
||
## TypeScript Mapped Types | ||
|
||
!!! info | ||
These are also referred to as "Generics", "Parameterized Types", "Utility Types", ... | ||
|
||
Parameterized types are not consistently supported in all supported target languages. **Go** support for generics is | ||
relatively limited (for good reasons) compared to TypeScript and most Object-Oriented languages, and the differences in | ||
generic semantics between **TypeScript**, **C#** and **Java** make it difficult to correctly represent such types in all | ||
those languages. As a consequence, `jsii` does not support declaring parameterized types. | ||
|
||
Certain *built-in* TypeScript types can however be used in `jsii` modules: | ||
|
||
- `Array<T>`, which is equivalent to `T[]` | ||
- `Record<string, T>`, which is equivalent to `{ [key: string]: T }` | ||
|
@@ -187,7 +209,35 @@ export interface IAsyncFooMaker { | |
} | ||
``` | ||
|
||
# Soft-Reserved Words | ||
!!! danger "`#!ts Pick<T, Keys>` and `#!ts Omit<T, Keys>`" | ||
Users are often tempted to use `#!ts Pick<T, Keys>` and `#!ts Omit<T, Keys>` when creating higher level abstractions | ||
of types exposed by their dependencies, and they want to expose all configuration options from the upstream | ||
implementation except for some specific properties which are determined fully by the new abstraction. | ||
|
||
`#!ts Pick<T, Keys>` and `#!ts Omit<T, Keys>` are not supported as they would result in open-ended implementation | ||
requirements to exist in languages such as **Java** and **C#** where such things are not possible. | ||
|
||
Users with this particular use-case should investigate generating code in order to reproduce the upstream type | ||
without the filtered out fields. For example, this can be done with [`projen`](http://npmjs.com/package/projen) | ||
using [`jsii-struct-builder`](https://github.com/mrgrain/jsii-struct-builder). | ||
|
||
## Type Aliases | ||
|
||
TypeScript supports type aliasing using the `#!ts export type Name = ...` syntax. While this is not considered a | ||
compilation error by the `jsii` compiler, those types are implicitly de-sugared by the compiler for all language targets | ||
except for **TypeScript**. | ||
|
||
```ts hl_lines="1-2 5-6" | ||
// 👻 Only visible in TypeScript | ||
export type FooOrBar = Foo | Bar; | ||
|
||
export interface Props { | ||
// ⚠️ Effectively `readonly fooOrBar: Foo | Bar;` in non-TypeScript | ||
readonly fooOrBar: FooOrBar; | ||
} | ||
``` | ||
|
||
## Soft-Reserved Words | ||
|
||
In order to guarantee a consistent developer experience across all supported languages, `jsii` emits warnings whenever | ||
a declaration is named after any target language's *reserved words*, as those will need renaming in target languages: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
mkdocs~=1.4.3 | ||
mkdocs-awesome-pages-plugin~=2.9.1 | ||
mkdocs-material~=9.1.15 | ||
mkdocs-material~=9.1.18 | ||
mkdocs-git-revision-date-plugin~=0.3.2 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
{ | ||
"lerna": "3.13.1", | ||
"npmClient": "yarn", | ||
"useWorkspaces": true, | ||
"rejectCycles": true, | ||
"packages": [ | ||
"packages/*" | ||
"packages/*", | ||
"packages/@jsii/*", | ||
"packages/@scope/*", | ||
"tools/*" | ||
], | ||
"command": { | ||
"bootstrap": { | ||
"rejectCycles": true | ||
} | ||
}, | ||
"version": "1.84.0" | ||
"version": "1.85.0", | ||
"$schema": "node_modules/lerna/schemas/lerna-schema.json" | ||
} |
Oops, something went wrong.