[Flow] Declare types for application
In Flow, you can make global declarion about types.
Run:
flow init
It will generate .flowconfig file, open it and add few lines of configration.
[libs] decls/ [ignore] .*/node_modules/.*
So it says that go to find 'decls' folders and use what has been defined as global type checking.
Declear a variable:
declare type PetAction = 'adopt' | 'foster';
Declear a function:
declare type PetShelterDispatch = (x: PetShelterActions) => void;
Declear an interface:
declare type Pet = { name: string; id: number; from: string; type: PetType; locationId: number; action?: PetAction; };
All those will be global available for React components.
So you can use those, for example:
// @flow module.exports = ([ { type: 'dog', name: 'Snoopy', from: 'Charlie', locationId: 0, id: 0 }, { type: 'cat', name: 'Garfield', from: 'John', locationId: 0, id: 1 } ]: Array<Pet>);
It is also good to declear type for "state", 'props':
// @flow const React = require('react'); type ModalProps = { dispatch: PetShelterDispatch; pet: Pet; }; type ModalState = { inquiry: ?PetInquiry; }; class PetModal extends React.Component { props: ModalProps; state: ModalState; onSubmitClick: () => void; ....
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
2016-02-28 [Hapi.js] Serving static files
2016-02-28 [Hapi.js] Using the response object
2016-02-28 [Hapi.js] Replying to Requests
2016-02-28 [Hapi.js] Route parameters
2016-02-28 [Hapi.js] Logging with good and good-console