Skip to content

Commit 3cd3c6e

Browse files
traviskaufmanhansl
authored andcommitted
docs(): add additional Dart gotchas
This commit adds Dart gotchas for object destructuring, type aliases, and tagged template literals, none of which are compilable by dart.
1 parent 4009fb9 commit 3cd3c6e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

docs/dart/writing-compatible-typescript.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,6 @@ Here's a list of gotchas to keep in mind when writing TypeScript code that will
4343
* **Lambdas need to abide to the type required.** Meaning that if a function requires a function that takes one argument, the lambda cannot be `() => {}`. Use `_` for temporary parameters. This is notable in Promises.
4444
* **Dynamic return values fat arrows can't return non-primitive types without casting.** For example, a fat arrow that return a promise (or Future) generates a warning if using directly, like so: `promiseA.then(() => promiseB)`. In this case simply using a block works as expected; `promiseA.then(() => { return promiseB; })`.
4545
* **Dart does not have [generic methods](http://www.typescriptlang.org/Handbook#generics)** ([issue](https://github.com/dart-lang/sdk/issues/254)).
46+
* **Dart does not have destructuring** but it does have a [proposal](https://github.com/dart-lang/dart_enhancement_proposals/issues/24) for it.
47+
* **Dart does not support type aliases.** Code like `type Nop = () => void` will not compile.
48+
* **Dart does not support [tagged template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#Tagged_template_literals)**.

0 commit comments

Comments
 (0)