google / google/closure-compiler

Allow to annotate `export default` with `@type`

Open
#3,528 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

(updated, see below) TypeScript allows to set a type on a function
![image](https://user-images.githubusercontent.com/21156791/71304856-22fd6d80-23dd-11ea-860f-903d352576a7.png)
CC should allow that too
This will allow to define a function as a type in one file and then use it in implementation.
This way I can create interfaces for functions, import them in implementations and have type checking done by the compiler. Otherwise, I have manually add the parameters to the function which I don't want to do because it's wasting time since I already have function's types in a separate place. TypeScript in vs code does it properly as you can see on the screenshot.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.