Vskills Certified TypeScript Developer β Questions and Answers
Question 1: Which TypeScript technique can help ensure audit log entries cannot be tampered with after they are written?
- Storing logs as TypeScript `const` declarations
- Using `readonly` properties on the log entry interface
- Appending a cryptographic hash or HMAC chaining each log entry to the previous one (Correct answer)
- Using `Object.freeze()` on log objects in memory
Correct answer: Appending a cryptographic hash or HMAC chaining each log entry to the previous one
HMAC-chaining or hash-linking log entries means any modification to a previous entry breaks the chain, making tampering detectableβa common requirement for compliance audit trails.
Question 2: What are the different types of variable scopes in TypeScript?
- Local Scope
- All of the above (Correct answer)
- Global Scope
- Class Scope
Correct answer: All of the above
Explanation: <br> Depending on how and where you define the Typescript variable, it can be in one of three scopes. <br> <br> Global Scope <br> When you define a global variable outside of a function, class, or code block, it is added to the global scope. They can be used in any part of the application. <br> Function Scope <br> Function variables defined within a function/class, etc. are function scoped. They can be used at any time during the function. They can't be used outside of the function. <br> Local scope <br> Within a code block, local variables are declared. They're also referred to as block variables.
Question 3: A stakeholder asks why the team chose TypeScript over JavaScript for a large-scale project. Which reason is most compelling from a team collaboration perspective?
- TypeScript runs faster than JavaScript in all environments
- TypeScript is required by all modern browsers
- TypeScript eliminates the need for unit tests
- TypeScript enables multiple teams to work on the same codebase with explicit contracts, reducing integration bugs (Correct answer)
Correct answer: TypeScript enables multiple teams to work on the same codebase with explicit contracts, reducing integration bugs
Explicit types serve as self-documenting contracts between teams, making it safer for multiple developers to change shared code without breaking consumers.
Question 4: A TypeScript team lead notices the build pipeline fails intermittently due to type errors introduced in shared types. What process improvement prevents this?
- Allow developers to bypass CI type checks with a flag when blocked
- Remove shared types and duplicate them in each consuming package
- Require all changes to shared types to include a type-check CI step that validates all consuming packages (Correct answer)
- Disable strict mode in the CI pipeline to reduce failures
Correct answer: Require all changes to shared types to include a type-check CI step that validates all consuming packages
A CI step that validates all consumers of shared types catches breaking changes before they reach main.
Question 5: What is service level agreement (SLA) in TypeScript technology?
- A type of software programming language
- A legal document for employee termination
- A formal agreement defining expected service performance standards between provider and client (Correct answer)
- An equipment warranty document from the manufacturer
Correct answer: A formal agreement defining expected service performance standards between provider and client
An SLA defines specific, measurable performance standards (uptime, response time, resolution time) that a service provider commits to deliver, with consequences for failing to meet these standards.
Question 6: Which dependency risk arises when a TypeScript project pins @types packages to a different major version than their corresponding runtime library?
- The type definitions may describe an API that does not match the installed runtime version, causing type-correct code to fail at runtime (Correct answer)
- The project will fail to compile entirely
- Tree-shaking will remove the mismatched types
- The compiler will automatically downgrade to the matching @types version
Correct answer: The type definitions may describe an API that does not match the installed runtime version, causing type-correct code to fail at runtime
If @types/library@3 is installed alongside library@4, the types describe version 3's API, so code that passes type checking may call methods that behave differently or do not exist in version 4.
Question 7: What is the purpose of the `satisfies` operator introduced in TypeScript 4.9?
- It replaces type assertions and removes the original type
- It enforces that a class satisfies an interface at runtime
- It removes excess property checks from object literals
- It validates an expression matches a type while preserving the narrowest inferred type (Correct answer)
Correct answer: It validates an expression matches a type while preserving the narrowest inferred type
`satisfies` checks that a value conforms to a type without widening it, so you get both type safety and access to the literal/inferred type.
Question 8: How can TypeScript's `Awaited<T>` utility type improve async code quality?
- It converts synchronous functions to async ones
- It marks a type as requiring await before use
- It unwraps nested Promise types, giving the resolved value type for deeply nested async operations (Correct answer)
- It cancels a Promise automatically after a timeout
Correct answer: It unwraps nested Promise types, giving the resolved value type for deeply nested async operations
`Awaited<Promise<Promise<string>>>` resolves to `string`, making generic async return type calculations accurate even with multiple levels of nesting.
Question 9: What is the main use case for TypeScript `namespace` in modern code?
- Grouping related declarations under a named scope, primarily in non-module (global) scripts (Correct answer)
- Creating classes that expose only static members
- Replacing ES module imports in all TypeScript projects
- Defining ambient types for third-party libraries
Correct answer: Grouping related declarations under a named scope, primarily in non-module (global) scripts
Namespaces group related code under a named scope to avoid global name collisions; in modern projects using ES modules, they are largely replaced by modules but still useful in global scripts.
Question 10: What does the `moduleResolution` option `bundler` (added in TypeScript 5.0) enable?
- CommonJS-style resolution
- Node 10-style resolution
- Resolution logic matching modern bundlers like Vite and esbuild, supporting package.json exports (Correct answer)
- Resolution of `.d.ts` files only
Correct answer: Resolution logic matching modern bundlers like Vite and esbuild, supporting package.json exports
`moduleResolution: bundler` aligns TypeScript's import resolution with tools like Vite and webpack that use `package.json` `exports` fields.
Question 11: A CI pipeline should fail when new TypeScript errors are introduced. Which command exits with a non-zero code on type errors without emitting files?
- tsc --declaration
- tsc --noEmit (Correct answer)
- tsc --strict
- tsc --watch
Correct answer: tsc --noEmit
`tsc --noEmit` type-checks the project and returns a non-zero exit code if errors exist, making it ideal for CI gates.
Question 12: In TypeScript, what is the best way to type a function that aggregates an array of sales records and returns a summary object with total and average?
- Define an explicit return type interface like SalesSummary (Correct answer)
- Use 'any' return type for flexibility
- Use unknown return type
- Return a tuple instead of an object
Correct answer: Define an explicit return type interface like SalesSummary
Defining an explicit return type interface ensures the aggregation function always returns a predictable, well-typed summary object.
Question 13: A developer discovers that a third-party TypeScript library used in production secretly collects user telemetry without disclosure. What is the most ethical course of action?
- Continue using it since it's open source
- Ignore it if the app performance is fine
- Remove the library and report the issue to the team and stakeholders (Correct answer)
- Disable telemetry via config and keep using it
Correct answer: Remove the library and report the issue to the team and stakeholders
Undisclosed data collection violates user privacy and must be addressed by removing the dependency and notifying relevant parties.
Question 14: Which of the following correctly applies a generic constraint in TypeScript?
- function fn<T extends object>(x: T) (Correct answer)
- function fn<T implements object>(x: T)
- function fn<T: object>(x: T)
- function fn<T>(x: T) where T extends object
Correct answer: function fn<T extends object>(x: T)
Generic constraints use the `extends` keyword inside the angle brackets, e.g., `<T extends object>`, to restrict which types can be substituted for T.
Question 15: Which versioning strategy should a TypeScript project library follow when making breaking changes to exported types?
- Minor version bump (1.0.0 β 1.1.0)
- Pre-release tag only (1.0.0 β 1.0.0-beta)
- Patch version bump (1.0.0 β 1.0.1)
- Major version bump (1.0.0 β 2.0.0) (Correct answer)
Correct answer: Major version bump (1.0.0 β 2.0.0)
Breaking changes to exported types are breaking API changes and require a major semver bump to signal incompatibility.
Question 16: What is a near-miss report in TypeScript safety management?
- A financial report on near-break-even performance
- A record of an employee who almost achieved their targets
- A report on a project that nearly met its deadline
- Documentation of an event that could have resulted in harm but did not (Correct answer)
Correct answer: Documentation of an event that could have resulted in harm but did not
A near-miss report documents events where an injury, damage, or loss almost occurred. These reports provide valuable data for preventing future incidents by identifying systemic weaknesses before actual harm occurs.
Question 17: Under the California Consumer Privacy Act (CCPA), what right allows a user to demand that a TypeScript-backed service delete all personal information it holds about them?
- Right to Opt-Out
- Right to Deletion (Right to be Forgotten) (Correct answer)
- Right to Portability
- Right to Non-Discrimination
Correct answer: Right to Deletion (Right to be Forgotten)
The CCPA's Right to Deletion lets California consumers request that businesses delete their personal information, subject to certain exceptions.
Question 18: A TypeScript library uses the LGPL license. Under what condition can a proprietary application link to it without being required to open-source the application?
- When the library is used only in unit tests
- When the application is sold commercially
- Never β LGPL always requires the application to be open source
- When the application links dynamically and allows users to replace the LGPL library (Correct answer)
Correct answer: When the application links dynamically and allows users to replace the LGPL library
The LGPL allows proprietary applications to link to the library provided the end user can replace the LGPL component, typically satisfied by dynamic linking.
Question 19: A data analyst asks you to create a TypeScript type for a metric that can be either a raw number or a formatted string percentage. What is the correct type?
- number & string
- number | string
- MetricValue = { raw: number; formatted: string } (Correct answer)
- any
Correct answer: MetricValue = { raw: number; formatted: string }
A discriminated object type with both raw and formatted fields keeps both representations together and avoids unsafe union coercions.
Question 20: Which TypeScript compiler option helps catch potential null dereference risks at compile time?
- noImplicitAny
- allowJs
- strictNullChecks (Correct answer)
- esModuleInterop
Correct answer: strictNullChecks
strictNullChecks prevents assigning null or undefined to typed variables unless explicitly allowed, catching null dereference risks at compile time.
Question 21: A technical writer asks you to explain TypeScript's `satisfies` operator (introduced in TS 4.9) for inclusion in developer documentation. What is the key point?
- `satisfies` is only available in TypeScript's strict mode
- `satisfies` validates that a value matches a type at compile time while preserving the value's most specific inferred type for subsequent use (Correct answer)
- `satisfies` is a runtime assertion that throws if the type does not match
- `satisfies` replaces the `as` type assertion and is always safer
Correct answer: `satisfies` validates that a value matches a type at compile time while preserving the value's most specific inferred type for subsequent use
Unlike `as`, `satisfies` checks type compatibility without widening the value's type, so you get both validation and the benefit of the narrower inferred type downstream.
Question 22: What does the `tsc --watch` command do in a TypeScript project?
- Starts a TypeScript language server
- Runs TypeScript tests in watch mode
- Watches files for changes and recompiles automatically (Correct answer)
- Compiles TypeScript once and exits
Correct answer: Watches files for changes and recompiles automatically
`tsc --watch` continuously monitors source files and recompiles whenever a change is detected.
Question 23: Which TypeScript utility type would you use to make all properties of an interface optional for a partial update function?
- Partial<T> (Correct answer)
- Required<T>
- Readonly<T>
- Pick<T, K>
Correct answer: Partial<T>
`Partial<T>` constructs a type with all properties of T set to optional, commonly used for PATCH-style update functions.
Question 24: What is a type guard in TypeScript?
- A function that returns a type predicate to narrow types at runtime (Correct answer)
- A decorator that validates types
- A function that throws when a type is wrong
- A built-in class for type safety
Correct answer: A function that returns a type predicate to narrow types at runtime
A type guard is a function with a return type predicate (`param is Type`) that tells TypeScript to narrow the type within the true branch of a conditional.
Question 25: Which TypeScript compiler option, when enabled, helps prevent accidental exposure of sensitive fields by making all class members private by default?
- strictNullChecks
- noImplicitAny
- useDefineForClassFields
- There is no such option; visibility must be declared manually (Correct answer)
Correct answer: There is no such option; visibility must be declared manually
TypeScript has no compiler flag that defaults class members to private; developers must explicitly annotate each member with `private` or use `#` private fields.
Question 26: What is the purpose of a risk matrix in TypeScript practice?
- To track employee attendance records
- To evaluate risks by plotting likelihood against severity of potential impact (Correct answer)
- To create a visual schedule of daily tasks
- To map the physical layout of a facility
Correct answer: To evaluate risks by plotting likelihood against severity of potential impact
A risk matrix plots the probability of occurrence against the severity of potential consequences, helping prioritize which risks need immediate attention and which can be monitored.
Question 27: A TypeScript codebase uses `strict: true` in tsconfig. Which behavior does this enable that would catch a missing budget category check?
- Prevents use of JavaScript files in the project
- Disallows all use of the any type
- Enables strictNullChecks, preventing null/undefined from being assigned to non-nullable types (Correct answer)
- Requires every function to have a return type annotation
Correct answer: Enables strictNullChecks, preventing null/undefined from being assigned to non-nullable types
`strict: true` enables `strictNullChecks` among others, requiring explicit handling of null and undefined values.
Question 28: A developer writes TypeScript utility functions that work correctly but are intentionally obfuscated to make themselves indispensable. This behavior violates:
- Team collaboration ethics and the principle of writing maintainable, transparent code (Correct answer)
- Semver versioning rules
- TypeScript's structural typing system
- ESLint complexity 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 29: A TypeScript SaaS application retains deleted user records for 2 years 'just in case'. Which GDPR principle does this most likely violate?
- Storage Limitation (Correct answer)
- Accuracy
- Lawfulness of Processing
- Data Minimization
Correct answer: Storage Limitation
GDPR's storage limitation principle requires that personal data be kept no longer than necessary for the specified purpose; indefinite retention after account deletion requires a specific legal basis.
Question 30: What is a dashboard in TypeScript data reporting?
- A visual display of key metrics and data points for at-a-glance monitoring of performance (Correct answer)
- A written report submitted monthly to management
- A physical control panel in an office
- A tool used only by IT departments
Correct answer: A visual display of key metrics and data points for at-a-glance monitoring of performance
A dashboard provides a consolidated visual display of important metrics, KPIs, and data trends, enabling stakeholders to quickly assess performance status and identify areas needing attention.
Question 31: What does the `never` type represent in TypeScript?
- A value that is null
- An optional parameter
- A value that is undefined
- A type with no possible values, such as the return of a function that always throws (Correct answer)
Correct answer: A type with no possible values, such as the return of a function that always throws
`never` represents the type of values that never occur, commonly used as the return type of functions that always throw or run infinitely.
Question 32: A budget app receives JSON from an API. What is the inferred TypeScript type of `JSON.parse(responseText)`?
- Record<string, unknown>
- unknown
- any (Correct answer)
- object
Correct answer: any
`JSON.parse()` returns `any` in TypeScript, so the result must be validated or cast before use in a type-safe way.
Question 33: What are potential consequences of non-compliance in TypeScript practice?
- No consequences if the violation is not discovered
- A simple verbal warning with no follow-up
- Fines, license revocation, legal liability, and reputational damage (Correct answer)
- Automatic contract renewal regardless of violations
Correct answer: Fines, license revocation, legal liability, and reputational damage
Non-compliance can result in monetary fines, suspension or revocation of professional licenses, civil or criminal liability, and lasting damage to professional reputation.
Question 34: When integrating a third-party charting library with no TypeScript definitions, what is the safest way to type its data input in your TypeScript data layer?
- Cast chart data to 'any' everywhere it's passed
- Avoid TypeScript in that file
- Write a custom .d.ts file with at least the input shape you use, or use DefinitelyTyped (Correct answer)
- Pass data directly with no type annotation
Correct answer: Write a custom .d.ts file with at least the input shape you use, or use DefinitelyTyped
Writing a minimal .d.ts declaration for the portion of the library you use provides type safety at the integration boundary without requiring a full type definition.
Question 35: A TypeScript interface `IFinancialService` is implemented by `BudgetService`. You call `service.processPayment()` where `service: IFinancialService`. This demonstrates:
- Duck typing β only checked at runtime
- Nominal typing β BudgetService is valid because it explicitly implements the interface
- Structural typing β BudgetService is valid because its shape matches IFinancialService (Correct answer)
- Both nominal and structural typing simultaneously
Correct answer: Structural typing β BudgetService is valid because its shape matches IFinancialService
TypeScript uses structural (duck) typing: compatibility is determined by the shape of types, not their declared names.
Question 36: A software contractor ships TypeScript code with no written agreement about IP ownership. Who typically owns the copyright in the US?
- The client who paid for the work automatically owns it
- Copyright is shared equally between contractor and client by default
- The contractor owns it unless a written work-for-hire agreement or IP assignment exists (Correct answer)
- The TypeScript compiler authors hold copyright over compiled output
Correct answer: The contractor owns it unless a written work-for-hire agreement or IP assignment exists
Under US copyright law, the author (contractor) owns the work by default; a work-for-hire arrangement or explicit IP assignment agreement is required to transfer ownership to the client.
Question 37: Which isn't the true with typescript.
- It is interpreted like JavaScript
- It is a superset of JavaScript
- Typescript is case sensitive
- It does support static data type (Correct answer)
Correct answer: It does support static data type
The correct answer: <br> It does support static data types
Question 38: What is stakeholder mapping in TypeScript practice?
- Tracking competitor locations on a city map
- Identifying all parties with an interest in a project and assessing their influence and expectations (Correct answer)
- Creating a geographical map of office locations
- Mapping customer demographic data by region
Correct answer: Identifying all parties with an interest in a project and assessing their influence and expectations
Stakeholder mapping identifies everyone affected by or interested in a project, then categorizes them by influence level, interest, and expectations to develop targeted communication and engagement strategies.
Question 39: In TypeScript, what is a literal type?
- A type defined in a .d.ts file
- A type that wraps a primitive
- A type inferred from a literal value like `42` or `'hello'` (Correct answer)
- A type only used in switch statements
Correct answer: A type inferred from a literal value like `42` or `'hello'`
Literal types restrict a variable to one specific value, such as `type Direction = 'left' | 'right'`, providing extremely precise type constraints.
Question 40: What does the `Record<K, V>` utility type create?
- A Map object at runtime
- An array of key-value pairs
- An object type with keys of type K and values of type V (Correct answer)
- A tuple of K and V
Correct answer: An object type with keys of type K and values of type V
`Record<K, V>` is a shorthand for defining an object type where every key is of type K and every value is of type V.
Question 41: A team is debating whether to enable 'strict' mode in tsconfig for a large legacy JavaScript project being migrated to TypeScript. What is the recommended professional approach?
- Create a separate tsconfig with strict mode for new files only, permanently
- Migrate incrementally using allowJs and gradually enable strict flags per module (Correct answer)
- Avoid strict mode entirely for legacy projects
- Enable strict mode immediately to get full benefits from day one
Correct answer: Migrate incrementally using allowJs and gradually enable strict flags per module
Incremental migration using allowJs lets the team adopt strict TypeScript gradually without blocking ongoing development.
Question 42: What is an intersection type in TypeScript?
- A type that combines multiple types into one, requiring all properties (Correct answer)
- A type only used with generics
- A type that removes properties from another type
- A type that can be one of several types
Correct answer: A type that combines multiple types into one, requiring all properties
An intersection type (written as `A & B`) combines multiple types so the resulting type has all properties of A and all properties of B.
Question 43: A TypeScript team lead is establishing a Definition of Done for pull requests. Which TypeScript-specific criterion is most critical to include?
- No use of generics without constraints
- All types must be defined in a separate .d.ts file
- No new TypeScript errors and no new 'any' usages without justification (Correct answer)
- All functions must use explicit return type annotations
Correct answer: No new TypeScript errors and no new 'any' usages without justification
Preventing new errors and undocumented 'any' usages maintains type safety standards without being overly prescriptive.
Question 44: A manager asks why the TypeScript team spends time writing `.d.ts` declaration files for an internal SDK. What is the business justification?
- Declaration files replace the need for unit tests
- Declaration files are required for the TypeScript compiler to run
- Declaration files let consumer teams get full IDE auto-complete and type safety without shipping source code (Correct answer)
- Declaration files improve JavaScript runtime performance
Correct answer: Declaration files let consumer teams get full IDE auto-complete and type safety without shipping source code
Publishing `.d.ts` files alongside compiled JavaScript gives consumers IDE support and compile-time safety without exposing proprietary source code.
Question 45: In TypeScript testing, what is the benefit of using `as const` assertions on test fixture objects?
- It converts the object to a JSON string automatically
- It makes the object mutable at runtime
- It narrows the type to literal types, preventing accidental value changes in fixtures (Correct answer)
- It disables type checking for that object
Correct answer: It narrows the type to literal types, preventing accidental value changes in fixtures
`as const` makes all properties readonly with literal types, ensuring test fixtures aren't accidentally modified between tests.
Question 46: When decorating a TypeScript financial service method with `@log`, what TypeScript compiler option must be enabled?
- allowJs
- useDefineForClassFields
- emitDecoratorMetadata
- experimentalDecorators (Correct answer)
Correct answer: experimentalDecorators
`experimentalDecorators: true` in tsconfig is required to use the decorator syntax in TypeScript.
Question 47: In a TypeScript expense tracker, `keyof Transaction` produces which type if `Transaction = { id: number; amount: number; category: string }`?
- string[]
- { id: number; amount: number; category: string }
- 'id' | 'amount' | 'category' (Correct answer)
- number | string
Correct answer: 'id' | 'amount' | 'category'
`keyof T` produces a union of the string literal types of all keys in T.
Question 48: How to install the Typescript installer?
- using npm
- None of the above
- Either using Visual Studio or npm (Correct answer)
- using Visual Studio
Correct answer: Either using Visual Studio or npm
Explanation: <br> The Node.js Package Manager, npm, is the easiest way to install TypeScript. If you already have npm installed, you can use the following command to install TypeScript globally (-g) on your computer: typescript npm install -g
Question 49: What is the difference between fixed and variable costs in TypeScript practice?
- There is no meaningful difference between them
- Fixed costs are always higher than variable costs
- Variable costs are optional while fixed costs are mandatory
- Fixed costs remain constant regardless of activity level; variable costs change with production volume (Correct answer)
Correct answer: Fixed costs remain constant regardless of activity level; variable costs change with production volume
Fixed costs (rent, insurance, salaries) remain constant regardless of output level, while variable costs (materials, commissions, utilities) fluctuate directly with the volume of activity or production.
Question 50: Which TypeScript compiler option should be enabled to catch implicit 'any' types that can silently corrupt data analysis results?
- noImplicitAny: true (Correct answer)
- allowJs: true
- strict: false
- skipLibCheck: true
Correct answer: noImplicitAny: true
noImplicitAny forces every variable and parameter to have an explicit or inferred type, preventing silent 'any' from hiding type errors in data pipelines.
Vskills Certified TypeScript Developer
The TypeScript certification exam validates knowledge of TypeScript language features including static types, interfaces, classes, generics, modules, decorators, and advanced type patterns used in professional web and application development.
Exam Rules
- You can skip questions and return to them later
- Flag questions for review before submitting
- No feedback shown until you submit the entire exam
- Unanswered questions count as wrong β answer everything
- 10 pretest questions are mixed in and don't affect your score
- Timer auto-submits when time runs out
- Your progress is auto-saved every 30 seconds