Do not emit references in generated declaration files if the --noresolve flag was set

This fixes a crash in the compiler when generating declarations with /// reference and noResolve
Sorry this is with no resolve, so it should be fine. Can you add a test case for without no resolve and make sure the d.ts file is not generated?