TypeScript Professional Standards & Ethics 5 — Questions and Answers
Question 1: A TypeScript developer working on a healthcare app realizes they lack domain expertise in medical terminology. The ethical response is to:
- Proceed and research terms on the fly
- Communicate the knowledge gap to the team and collaborate with domain experts before writing critical logic (Correct answer)
- Use generic variable names to avoid domain specifics
- Request a transfer to a different project silently
Correct answer: Communicate the knowledge gap to the team and collaborate with domain experts before writing critical logic
Recognizing and communicating domain knowledge gaps prevents dangerous misunderstandings and is a mark of professional integrity.
Question 2: Which TypeScript configuration option enforces that developers do not accidentally use values that could be `null` or `undefined` without checking, upholding a standard of defensive coding?
- noImplicitAny
- strictFunctionTypes
- strictNullChecks (Correct answer)
- esModuleInterop
Correct answer: strictNullChecks
`strictNullChecks` forces developers to handle `null` and `undefined` explicitly, preventing a large class of runtime errors.
Question 3: A developer writes TypeScript utility functions that work correctly but are intentionally obfuscated to make themselves indispensable. This behavior violates:
- ESLint complexity rules
- Team collaboration ethics and the principle of writing maintainable, transparent code (Correct answer)
- TypeScript's structural typing system
- Semver versioning rules
Correct answer: Team collaboration ethics and the principle of writing maintainable, transparent code
Intentional obfuscation to create job security is unethical; professional standards require writing clear, maintainable code for team benefit.
Question 4: When a TypeScript open-source contributor submits a PR that fixes a bug but introduces a breaking change to the public API, the ethical standard requires:
- Merging silently since the bug fix is more important
- Clearly documenting the breaking change, bumping the major version, and providing a migration guide (Correct answer)
- Reverting the fix to preserve API stability
- Implementing the fix only for paid customers
Correct answer: Clearly documenting the breaking change, bumping the major version, and providing a migration guide
Breaking changes must be communicated via a major version bump and migration guide to honor the semver contract with existing users.
Question 5: A TypeScript developer copies a Stack Overflow code snippet under a CC BY-SA license into a proprietary commercial product without attribution or license compliance. This violates:
- TypeScript module resolution standards
- Copyright law and open-source licensing obligations (Correct answer)
- Node.js runtime compatibility requirements
- ESLint rule configurations
Correct answer: Copyright law and open-source licensing obligations
CC BY-SA requires attribution and share-alike terms; using it in a proprietary product without compliance violates the license and copyright law.
Question 6: What professional responsibility do TypeScript developers have when they encounter performance-degrading code in a production codebase they did not write?
- Leave it since they didn't write it
- Silently refactor and deploy without communication
- Document the issue, communicate with the team, and follow the established change process (Correct answer)
- Immediately rewrite the entire module
Correct answer: Document the issue, communicate with the team, and follow the established change process
Professionals address technical issues through proper communication and process rather than unilateral silent changes or avoidance.
Question 7: Using TypeScript's `Readonly<T>` utility type for configuration objects passed across module boundaries best demonstrates which professional standard?
- Minimizing bundle size through tree-shaking
- Preventing accidental mutation of shared state, making data flow explicit and safe (Correct answer)
- Enabling faster TypeScript compilation
- Replacing runtime validation with compile-time checks only
Correct answer: Preventing accidental mutation of shared state, making data flow explicit and safe
`Readonly<T>` enforces immutability at the type level, preventing modules from accidentally mutating shared configuration and creating hard-to-trace bugs.
A TypeScript developer working on a healthcare app realizes they lack domain expertise in medical terminology.
The ethical response is to: