Add library extern, fix type annotation.