CONDENSED CONSOLIDATED STATEMENTS OF CASH FLOWS - USD ($)
$ in Thousands
12 Months Ended
Dec. 31, 2021
Dec. 31, 2020
Dec. 31, 2019
Cash flows from operating activities:      
Net loss $ (196,547) $ (167,731) $ (163,458)
Adjustments to reconcile net loss to net cash used in operating activities:      
Stock-based compensation expense 35,610 33,665 41,271
Depreciation and amortization expense 7,723 5,691 2,995
Amortization (accretion) of premium (discount) on investments 118 266 (2,320)
Loss on disposal of property and equipment     335
Non-cash interest expense 1,280 349 289
Changes in operating assets and liabilities:      
Prepaid expenses and other current assets 1,249 992 2,655
Operating lease, right-of-use-asset 5,352 5,539 4,991
Other assets 5 46 2
Accounts payable 5,858 (1,369) (1,037)
Accrued expenses and other current liabilities (816) (96) 6,107
Other long-term liabilities (553) 283 396
Operating lease liabilities (4,401) (5,283) (2,670)
Net cash used in operating activities (145,122) (127,648) (110,444)
Cash flows from investing activities:      
Purchases of property, plant and equipment (3,649) (5,497) (40,657)
Purchases of investments   (122,671) (319,133)
Sales and maturities of investments 85,000 228,600 227,155
Net cash provided by (used in) investing activities 81,351 100,432 (132,635)
Cash flows from financing activities:      
Proceeds from underwritten public offering of common stock, net of commissions and underwriting discounts 188,000    
Payments of offering costs (360)    
Payments of debt issuance costs (150)    
Repurchase of unvested restricted common stock     (122)
Proceeds from borrowings under loan and security agreement   25,000 25,000
Proceeds from issuance of common stock upon exercise of stock options 10,963 1,484 2,413
Net cash provided by financing activities 198,453 26,484 27,291
Net increase (decrease) in cash, cash equivalents and restricted cash 134,682 (732) (215,788)
Cash, cash equivalents and restricted cash at beginning of period 92,901 93,633 309,421
Cash, cash equivalents and restricted cash at end of period 227,583 92,901 93,633
Supplemental cash flow information:      
Cash paid for interest 5,092 3,822 2,961
Cash paid for leases 7,364 8,486 5,375
Supplemental disclosure of non-cash investing and financing information:      
Purchases of property, plant and equipment included in accounts payable or accrued expenses 1,989 317 3,095
Offering costs and issuance costs included in accounts payable and accrued expenses $ 35    
Lease assets obtained in exchange for new operating lease liabilities   496 49,799
Proceeds from issuance of common stock upon exercise of stock options in other current assets     $ 32
Lease asset derecognized upon lease cancellation   $ 982