TS: Fixed a bug with forward type declarations that was not properly replaced with the real type declaration or its import.