What is the correct type of a 'set' function in TypeScript?

I have a function in TypeScript like this:

set parameter(value: string) {
  this._paremeter = value;

This works fine. I thought for the sake of completeness: Let's add the correct type that says this function doesn't retun anything. However, none is working:

set parameter(vale: string): void {}
set parameter(vale: string): never {}

I also tried these, just to make sure. But of course any of these won't work either:

set parameter(vale: string): undefined {}
set parameter(vale: string): null {}

Is there a correct type or should a set-function simply have no type at all?

Setters do not support specifying a return type.

From the language specification:

SetAccessor:set PropertyName ( BindingIdentifierOrPattern TypeAnnotation (optional) ) { FunctionBody }

Solved: Match The Characteristics With The Correct Type Of , Answer to Match the characteristics with the correct type of radiation: alpha beta gamma causes most internal travels at 9/10 lowe The type alignment setting is sometimes referred to as text alignment, text justification, or type justification. The edge of a page or column is known as a margin , and a gap between columns is known as a gutter .

From the Typescript documentation

TypeScript supports getters/setters as a way of intercepting accesses to a member of an object. This gives you a way of having finer-grained control over how a member is accessed on each object.

And there is an example of a set

set fullName(newName: string) {
        if (newName && newName.length > fullNameMaxLength) {
            throw new Error("fullName has a max length of " + fullNameMaxLength);

        this._fullName = newName;

In concluision, a set method cannot return a type so, your first approach is the right one.

set parameter(value: string) {
  this._paremeter = value;

Typescript: What is the correct type for a Timeout?, For this case, I will give you 2 options: Define type of debounceResize as return type of setTimeout , use ReturnType native generic. Correct definition is - to make or set right : amend. How to use correct in a sentence. Synonym Discussion of correct.

A 'set' accessor cannot have a return type annotation in Typescript language.

If you have tslint activated, it will show error ts(1095)

Formal Methods and Software Engineering: 19th International , The results show that our tool predicts correct types for 58.15% (1356) are due to the lack of the type quantifier signed and unsigned), in total proper types for  The dog breed selector helps you determine which type of dog you should get. Visit Animal Planet now to take the dog breed quiz and find out.

What is the correct type of a 'set' function in TypeScript?, Setters do not support specifying a return type. From the language specification: SetAccessor: set PropertyName ( BindingIdentifierOrPattern TypeAnnotation  Choose the Right Types Scientists give bacteria three names: genus, species, and strain. You'll see something like " Bifidobacterium longum W11," where bifidobacterium is the genus, longum is the

Microsoft Visual C#: An Introduction to Object-Oriented Programming, percentage commission rate, and a character code for the vehicle type. The correct method will execute only when all arguments of the correct types are sent​  Search, watch, and cook every single Tasty recipe and video ever - all in one place!

Critical Appraisal of Medical Literature, These errors are classified into type I and type II errors. Type I error happens when we reject a true or correct null hypothesis. Imagine that we conduct a study​  Before you start your training and nutrition regimen, it's a good idea to figure out your body type. Knowing which of the three basic body types you're closest to will help you better tailor your diet and exercise plan to meet your needs, and set realistic, attainable goals that pave the way to your success.