The invention is fused heterocyclic compounds of formula (I), and salts thereof, compositions thereof, and methods of use therefor. In particular, disclosed herein are certain fused heterocyclic compounds that can be useful for inhibiting protein kinase, including Bruton’ s tyrosine kinase (Btk), and for treating disorders mediated thereby.本發明涉及式(I)的稠合雜環化合物,及其鹽,藥物組合物,和它們的使用方法。特別是,本發明所公開的某些稠合雜環化合物,可用於抑制蛋白激酶,包括布魯頓酪氨酸激酶(Btk),並用於治療由該激酶引起的疾病。